#include<bits/stdc++.h>
using namespace std;
int const p[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int a[55];
int main()
{
    int n,x;long long ans=9e18;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    for(int i=0;i<(1<<15);i++)
    {
        long long res=1;
        for(int j=0;j<15;j++)
            if(i&(1<<j))res*=p[j];
        int flag=1;
        for(int j=1;j<=n;j++)if(__gcd(res,(long long)a[j])==1){flag=0;break;}
        if(flag)ans=min(ans,res);
    }
    cout<<ans;
    return 0;
}
//code bcuz love,code 4 hate
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define re register int
#define fr first
#define sd second
#define pa pair<ll,ll>
#define FOR(i,a,b) for(re i=a;i<=b;i++)
#define REP(i,a,b) for(re i=a;i>=b;i--)
#define MEM(a) memset(a,0,sizeof(a))
#define N 51
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
inline ll lowbit(ll x){return x&(-x);}
ll n,ans=5e18;
ll a[N],p[N],tot,b[N][N];
inline void Solve(ll x,ll v)
{
	ll tmp=v;
	for(re i=2;i*i<=v;i++)
	{
		if(tmp%i==0){b[x][i]=1;while(tmp%i==0)tmp/=i;}
	}
	if(tmp>1){b[x][tmp]=1;}
}
inline ll check(ll x){for(re i=2;i<x;i++)if(x%i==0)return 0;return 1;}
int main()
{
	//ios::sync_with_stdio(false);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();FOR(i,1,n)a[i]=read(),Solve(i,a[i]);
	FOR(i,2,50)if(check(i))p[++tot]=i;
	FOR(S,0,(1<<tot)-1)
	{
		ll v=1;
		FOR(i,0,tot-1)if((S>>i)&1)v*=p[i+1];
		ll fl=1;
		FOR(i,1,n)
		{
			ll flag=0;
			FOR(j,0,tot-1)if((S>>j)&1)if(b[i][p[j+1]]){flag=1;}
			if(!flag){fl=0;break;}
		}
		if(fl)ans=min(ans,v);
	}
	cout<<ans<<'\n';
	return 0;
}
