#include<bits/stdc++.h>
#define ll              long long int
#define ld              long double
#define ff              first
#define ss              second
#define mkpr            make_pair
#define ins             insert
#define sb              substr
#define con             continue
#define ub              upper_bound
#define lb              lower_bound
#define bp              __builtin_popcountll
#define pll             pair<ll,ll>
#define pld             pair<ld,ld>
#define take(v,n)       for(i=0;i<n;i++) cin>>v[i];
#define print(any)      for(auto i:any) cout<<i<<" ";
#define ee              endl
#define pb              push_back
#define vll             vector<ll>
#define vld             vector<ld>
#define vvll            vector< vector<ll> >
#define vvld            vector< vector<ld> >
#define mll             map<ll,ll>
#define umll            unordered_map<ll,ll>
#define f(i,x,y)        for(ll i=x;i<y;i++)
#define INF             LLONG_MAX
#define fast            ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s(x)            sort(x.begin(),x.end())
#define all(v)          v.begin(),v.end()
#define p2(n,x)         cout << fixed << setprecision(x) <<n<<" ";
#define yes             cout<<"YES"<<endl
#define no              cout<<"NO"<<endl
#define mod             1000000007
using namespace std;

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);
bool isPrime(ll n);

void slv()
{
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,t,u,w,x,y,z;
    string s,s1,s2;
    char ch;
    cin>>n;
    vll ar={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
    mll mp;
    vll num(n);
    take(num,n);

    k=1;
    ll ans=INF;
    while(k<(1<<16))
    {
        p=k;
        c=1;
        f(i,0,15)
        {
            if(p&1) c*=ar[i];
            p=p>>1;
        }
        a=1;
        f(i,0,n)
        {
            if(__gcd(c,num[i])==1)
            {
                a=0;
                break;
            }
        }
        if(a)  ans=min(ans,c);
        k++;
    }
    cout<<ans<<ee;
}

int main()
{
    fast
    ll t;
    t=1;
    //cin>>t;
    //fun();
    while(t--)
    {
        slv();
    }
    return 0;
}

/*

*/

ll modInv(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}

ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}

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

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(b==0)return a;
	return gcd(b,a%b);
}

int main(){
	int n;
	scanf("%d",&n);
	long long arr[n];
	for(int i=0;i<n;i++)scanf("%lld",&arr[i]);
	long long p[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
	long long ans=1012345678012345678LL;
	for(int i=0;i<(1<<15);i++){
		long long prod=1;
		int bm=i;
		while(bm&(-bm)){
			prod*=p[__builtin_ctz(bm)];
			bm-=(bm&(-bm));
		}
		bool poss=1;
		for(int j=0;j<n;j++){
			if(gcd(prod,arr[j])==1){poss=0;break;}
		}
		if(poss)ans=min(ans,prod);
	}
	printf("%lld",ans);
}
