2. What is the output of the following C++ program?

#include <iostream>
#include <stdexcept>

class A
{
public:
    A(int n) : m_n(n) { std::cout << m_n; }

    ~A() { std::cout << m_n; }

private:
    int m_n;
};

int f(int n)
{
    if (1 == n) {
        throw std::logic_error("0");
    }
    A l(n);
    return f(n - 1) * n / (n - 1);
}

int main()
{
    try {
        int r = f(3);
        A a(r);
    }
    catch (const std::exception &e) {
        std::cout << e.what() << std::endl;
    }

    return 0;
}