#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
    if (y == 0) return x;
    return gcd(y, x % y);
}

int main() {
    int prime[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];
    ll ans = 1e18;
    rep(i, 1 << 15) {
        ll a = 1;
        rep(j, 15) {
            if ((i >> j) & 1) a *= prime[j];
        }
        bool f = true;
        rep(j, N) {
            if (gcd(a, X[j]) == 1) {
                f = false;
                break;
            }
        }
        if (f) ans = min(ans, a);
    }
    cout << ans << "\n";
}
#include <iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#define f first
#define s second
using namespace std;
vector<pair<int,int> > e(60);
vector<int> num;
bool cmp(pair<int,int> a,pair<int,int> b){
    if(a.first==b.first) return a.second<b.second;
    return a.first>b.first;
}
int main() {
    int n,x;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        for(int j=2;j<=x;j++){
            if(x%j==0){
                e[j].first++;
                e[j].second=j;
            }
        }
        num.push_back(x);
    }
    long long now=n,ans=1;
    while(now>0){
        sort(e.begin(),e.end(),cmp);
        long long tmp=e[0].second;
        //cout<<"tmp="<<tmp<<endl;
        for(int i=0;i<n;i++){
            if(num[i]%tmp==0){
                //cout<<"who="<<i<<endl;
                num[i]=1;
                now--;
            }
        }
        for(int i=0;i<60;i++){
            e[i].first=0;
            e[i].second=0;
        }
        ans*=tmp;
        for(int i=0;i<n;i++){
            for(int j=2;j<=num[i];j++){
                if(num[i]%j==0){
                    e[j].first++;
                    e[j].second=j;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
