#include <bits/stdc++.h>

using namespace std;

//begin of def
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define endl '\n'

using lli = long long int;
using ulli = unsigned long long int;
using Ld = long double;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using pld = pair<Ld, Ld>;
#define X first
#define Y second

#define rep(I, S, E) for(int I = (S); I < (E); I++)
#define repq(I, S, E) for(int I = (S); I <= (E); I++)

#define pb push_back
#define epb emplace_back

#define ALL(X) X.begin(), X.end()
//end of def

vector<lli> v;

int main(){
    fastio;
    vector<lli> p;
    lli test = 1;
    repq(i, 2, 50){
        bool f = true;
        rep(j, 2, i){
            if(i % j == 0){
                f = false;
                break;
            }
        }
        if(f){
            p.pb(i);
            test *= i;
        }
    }
    v.resize(p.size());

    int n;
    cin >> n;
    rep(i, 0, n){
        int k;
        cin >> k;
        rep(j, 0, p.size()){
            if(k % p[j] == 0)
                v[j] |= (1LL << i);
        }
    }
    lli mn = 4e18;
    rep(t, 1, 1LL << p.size()){
        lli x = 0, mul = 1;
        rep(j, 0, p.size()){
            if(t & (1LL << j)){
                x |= v[j];
                mul *= p[j];
            }
        }
        if(x == (1LL << n) - 1){
            mn = min(mn, mul);
        }
    }
    cout << mn;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

unsigned long long p[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}, n, a[55];

unsigned long long ans = 614889782588491410LL;

void dfs(unsigned long long x, unsigned long long y){
    if(x > 15){
        unsigned long long ret = 0;
        for(unsigned long long i = 1; i <= n; i++) ret += __gcd(1LL * a[i], y) > 1;
        if(ret == n) ans = min(ans, y);
        return;
    }
    y *= p[x], dfs(x + 1, y), y /= p[x], dfs(x + 1, y);
}

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