#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define fore(i, a) for (auto &i : a)
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
const ll INF = 1LL << 60;
const ll mod = 1E9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    ll temp = a;
    a = b;
    b = temp;
  }
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int N;
  cin >> N;
  vector<int> a = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
  vector<int> x(N);
  rep(i, N) cin >> x[i];
  ll ans = INF;
  for (int bit = 1; bit < (1 << 15); bit++) {
    ll temp = 1;
    rep(i, 15) {
      if (bit & (1 << i)) temp *= a[i];
    }
    rep(i, N) {
      if (gcd(temp, x[i]) == 1) {
        temp = INF;
        break;
      }
    }
    ans = min(temp, ans);
  }
  cout << ans << endl;
  return 0;
}
#include<bits/stdc++.h>
#define ll long long int
#define pi acos(-1)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

ll mod=1000000007;
bool sortBysec(pair<ll,ll>a,pair<ll,ll>b)
{
    return a.second>b.second;
}

bool prime[2000010];
vector<ll>vv;
void SieveOfEratosthenes(ll n)
{

    memset(prime, true, sizeof(prime));

    for (ll p=3; p*p<=n; p+=2)
    {

        if (prime[p] == true)
        {

            for (ll i=p*p; i<=n; i +=(2*p))
                prime[i] = false;
        }
    }

}


ll binExp(ll a,ll n)
{
    ll res=1;
    while(n)
    {
        if(n%2==1)
        {
            res=(res*a)%mod;
            n--;
        }
        else
        {
            a=(a*a)%mod;
            n=n/2;
        }
    }
    return res;
}

ll ncr(ll n,ll r)
{
    if(r>n-r)
    {
        r=n-r;
    }
    ll i,j,ans=1;
    for(i=n,j=1; j<=r; j++,i--)
    {
        ans=((ans*i)%mod);
        ans=(ans*binExp(j,mod-2))%mod;
    }
    return ans;
}

ll power(ll n,ll m)
{
    ll ans=1;
    while(m)
    {
        ans*=n;
        m--;
    }
    return ans;
}

ll digsum(ll n)
{
    ll sum=0;
    while(n)
    {
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll fact(ll n)
{
    ll ans=1;
    for (ll i=1; i<=n; i++)
    {
        ans*=i;
    }
    return ans;
}
ll npr(ll n,ll r)
{
    ll ans=1;
    for(ll i=n,j=1; j<=r; j++,i--)
    {
        ans=((ans%mod)*(i%mod))%mod;
    }
    return ans;
}



int main()
{
    FAST();
    ll t=1,i,m,n,j,k,x,y,p,c,d,q,a,b;
    //cin>>t;
    while(t--)
    {
      cin>>n;
      vector<ll>v,u,w;

      for(i=0;i<n;i++)
      {
          cin>>k;
          v.push_back(k);
      }
    map<ll,ll>mp;

    for(i=2;i<=25;i++)
    {
        mp[i*2]=1;
    }
    for(i=3;i<=50;i+=2)
    {
        if(mp[i]==0)
        {

            for(j=i*i;j<=50;j+=2*i)
            {
                mp[j]=1;
            }
        }
    }
    for(i=2;i<=50;i++)
    {
        if(mp[i]==0)
        {
            u.push_back(i);
           // cout<<i<<" ";
        }
    }
   // cout<<endl;



       map<ll,ll>mcp;
       for(i=0;i<u.size();i++)
       {
           ll cc=w.size();
           for(j=0;j<cc;j++)
           {
               if(mcp[w[j]*u[i]]==0)
               {
               w.push_back(w[j]*u[i]);
               mcp[w[j]*u[i]]=1;
               }
           }
           if(mcp[u[i]]==0)
           {
           w.push_back(u[i]);
           mcp[u[i]]=1;

           }
       }
//
       sort(w.begin(),w.end());

     ll f,ans;
       for(i=0;i<w.size();i++)
       {
           f=0;
           for(j=0;j<v.size();j++)
           {
               if(__gcd(v[j],w[i])<=1)
               {
                   f=1;
                   break;
               }
               //cout<<__gcd(v[j],w[i])<<" ";
           }
          // cout<<endl;
           if(f==0)
           {
               ans=w[i];
               break;
           }
       }

       cout<<ans<<endl;
    }

    return 0;

}

/*

   ❀(◕‿◕)❀

 */
