#include<bits/stdc++.h>
using namespace std;
#define INF 2047483647
#define INFL 9223372036854775807
#define ll long long
#define pii pair<ll,ll>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ull unsigned long long
#define M 1000000007
//#define M 998244353
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define take(x) scanf("%d",&x)
#define DE(x) printf("\ndebug %d\n",x);
#define vout(x) for(int i=0;i<x.size();i++) printf("%d ",x[i]);
#define pie acos(-1)
#define MOD 998244353
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
int main(){
    int n,a;
    cin>>n;
    int gcd = 0;
   // int ara[n];
    map<int,int> m;
    for(int i=0;i<15;i++) m[ primes[i] ] = 1;
    vector<int> ara;
    vector<ll> p;
    for(int i=0;i<n;i++){
        cin>>a;
     // a=i+2;
      if( m[a] == 0 ) ara.pb(a);
      else p.pb(a);
    }
    ll val = 0;
    for(int i=1;i<250;i++){
        bool pos = true;
        for(int j=0;j<ara.size();j++){
            if( __gcd(ara[j],i) == 1 ) pos = false;
        }
        if( pos ) {
            val = i;
            break;
        }
    }
    for(int i=0;i<p.size();i++){
        if( __gcd(p[i],val) == 1 ) val = val*p[i];
    }
    cout<<val;
}

#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);
}