#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

const int max_n = 100111, mod = 998244353;

int n, a[max_n];

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = 1;
    for (int i = 0; i < n; ++i) {
        ans = 1LL * ans * __gcd(a[i], i);
    }
    cout << ans << endl;
    return 0;
}
