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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()
#define ff first
#define ss second

const double pi=3.1415926535897932384626433832795;
const int inf=1e9;
const ll inf2=1e18;
const int mod=1e9+7;

void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll pr[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};

void solve(){
    int n;
    cin>>n;
    vi arr(n);
    int m=sizeof(pr)/sizeof(pr[0]);
    fr(i,0,n){
        cin>>arr[i];
        int temp=0;
        for(int j=0;j<m;j++){
            if(arr[i]%pr[j] ==0){
                temp|=(1<<j);
            }
        }
        arr[i]=temp;
        // cout<<arr[i]<<endl;
    }
    ll ans=inf2;
    for(int mask=1;mask<(1<<m);mask++){
        bool poss=true;
        for(int i=0;i<n;i++){
            if(!(mask&arr[i])){
                poss=false;
                break;
            }
        }
        if(!poss)
            continue;
        ll val=1;
        for(int j=0;j<m;j++){
            if((mask>>j)&1)
                val*=pr[j];
        }
        // cout<<val<<endl;
        ans=min(ans,val);
    }
    cout<<ans<<endl;
    return;
}

int main()
{
    boost();
    
    int tc=1;
    //cin>>tc;
    while(tc--)
        solve();
    return 0;
}
		/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	vector<ll>pp;
	for(ll i=2;i<=50;i++)
	{
	    if(isPrime(i))
	    {
	        pp.eb(i);
	    }
	}
	ll n;
	cin>>n;
	vector<ll>X(n);
	for(ll i=0;i<n;i++)
	{
	    cin>>X[i];
	}
	ll nn=pp.size();
	vector<ll>lol;
	for(ll i=0;i<(1LL<<nn);i++)
	{
	    ll temp=1;
	    for(ll j=0;j<nn;j++)
	    {
	        if((i>>j)&1LL)
	        {
	            temp*=pp[j];
	        }
	    }
	    lol.eb(temp);
	}
	sort(lol.begin(),lol.end());
	for(auto &temp:lol)
	{
	    ll fl=0;
	    for(ll k=0;k<n;k++)
	    {
	        if(__gcd(temp,X[k])==1)
	        {
	            fl=1;
	            break;
	        }
	    }
	    if(fl==0)
	    {
	        cout<<temp<<endl;
	        return 0;
	    }
	}
    return 0;
}


//252908XL