#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N; cin>>N;
    vec_int X(N); rep(i,N)cin>>X.at(i);
    vec_int primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
    int ans = 1;
    rep(i,primes.size())ans*=primes.at(i);
    for(int i=0;i<(1<<primes.size());i++){
        int num = 1;
        int temp = 1;
        for(int j=0;j<primes.size();j++){
            if((i/temp)%2==1){
                num*=primes.at(j);
            }
            temp*=2;
        }
        int flag = 1;
        rep(j,N){
            if(__gcd(X.at(j), num)==1){
                flag = 0;
                break;
            }
        }
        if(flag == 1){
            ans = min(ans, num);
        }

    }
    cout<<ans<<endl;


    return 0;
}
#include <bits/stdc++.h>
// #include <atcoder/all>
// #include "icld.cpp"
using namespace std;
using ll = long long int;
using vi = vector<int>;
using si = set<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using ss = string;
using db = double;
template<typename T> using minpq = priority_queue <T,vector<T>,greater<T>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
#define V vector
#define P pair<int,int>
#define PLL pair<ll,ll>
#define rep(i,s,n) for(int i=(s);i<(int)(n);i++)
#define rev(i,s,n) for(int i=(s);i>=(int)(n);i--)
#define reciv(v,n) vll (v)((n)); rep(i,0,(n))cin>>v[i]
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ci(x) cin >> x
#define cii(x) ll x;cin >> x
#define cci(x,y) ll x,y;cin >> x >> y
#define co(x) cout << x << endl
#define pb push_back
#define eb emplace_back
#define rz resize
#define pu push
#define sz(x) int(x.size())
#define vij v[i][j]
// ll p = 1e9+7;
// ll p = 998244353;
// n do -> n*pi/180
#define yn cout<<"Yes"<<endl;else cout<<"No"<<endl
#define YN cout<<"YES"<<endl;else cout<<"NO"<<endl
template<class T>void chmax(T &x,T y){x=max(x,y);}
template<class T>void chmin(T &x,T y){x=min(x,y);}

vll prm;

int main(){
  int ma=52;
  vi pp(ma,1);

  rep(i,2,ma){
    if(pp[i]){
      prm.pb(i);
      rep(j,i+i,ma){
        pp[j]=0;
        j+=i-1;
      }
    }
  } 

  cii(n);
  reciv(v,n);

  ll ans=3e18;

  int m=sz(prm);
  int m2=1<<m;

  rep(bn,0,m2){
    ll now=1;
    rep(i,0,m)if(bn>>i&1)now*=prm[i];

    int f=1;
    rep(i,0,n)if(__gcd(now,v[i])==1)f=0;

    if(f)chmin(ans,now);
  }

  co(ans);
}