/**************************************************************
 * Problem:
 * Author: Vanilla_chan
 * Date:
**************************************************************/
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<vector>
#include<limits.h>
#define IL inline
#define re register
#define LL long long
#define ULL unsigned long long
#ifdef TH
#define debug printf("Now is %d\n",__LINE__);
#else
#define debug
#endif
#ifdef ONLINE_JUDGE
char buf[1<<23],* p1=buf,* p2=buf,obuf[1<<23],* O=obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
#endif
using namespace std;

template<class T>inline void read(T& x)
{
	char ch=getchar();
	int fu;
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') fu=-1,ch=getchar();
	x=ch-'0';ch=getchar();
	while(isdigit(ch)) { x=x*10+ch-'0';ch=getchar(); }
	x*=fu;
}
inline int read()
{
	int x=0,fu=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') fu=-1,ch=getchar();
	x=ch-'0';ch=getchar();
	while(isdigit(ch)) { x=x*10+ch-'0';ch=getchar(); }
	return x*fu;
}
int G[55];
template<class T>inline void write(T x)
{
	int g=0;
	if(x<0) x=-x,putchar('-');
	do { G[++g]=x%10;x/=10; } while(x);
	for(int i=g;i>=1;--i)putchar('0'+G[i]);putchar('\n');
}
#define N 110
LL gcd(LL a,LL b)
{
	if(b) return gcd(b,a%b);
	return a;
}
int n,x[N];
bool book[N];
int prime[N],cnt;
void init()
{
	book[1]=1;
	for(int i=2;i<=50;i++)
	{
		if(!book[i])
		{
			prime[++cnt]=i;
			for(int j=2;i*j<=50;j++) book[i*j]=1;
		}
	}
}
bool y[N];
LL ans=1e18+5;
LL check()
{
	LL tmp=1;
	for(int i=1;i<=cnt;i++) if(y[i]) tmp*=prime[i];
	for(int i=1;i<=n;i++)
	{
		if(gcd(tmp,x[i])==1) return 0;
	}
	return tmp;
}
void dfs(int p)
{
	LL t;
	if(t=check())
	{
		ans=min(ans,t);
		return;
	}
	if(p==cnt+1) return;
	dfs(p+1);
	y[p]=1;
	dfs(p+1);
	y[p]=0;
}
int main()
{
	n=read();
	init();
	for(int i=1;i<=n;i++) x[i]=read();
	dfs(1);
	write(ans);
	return 0;
}



#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, l, r) for (int i = l; i <= (int)(r); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define all(v) v.begin(), v.end()
#define MOD (int) (1e9+7)
#define INF (int) 1e9
#define LLINF (ll) 1e18

int main(){
	int n;
	cin >> n;

	ll x[n];
	rep(i, n) cin >> x[i];

	vector<int> ps{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};

	ll ans = LLINF;
	rep(ni, 1<<ps.size()){
		vector<int> use(15);
		int ii = ni;
		rep(iii, 15){
			use[iii] = ii&1;
			ii >>= 1;
		}
		
		ll tmp = 1;
		rep(i, 15){
			if(use[i]==1) tmp *= ps[i];
		}

		bool ok = true;
		rep(i, n){
			if(__gcd(tmp, x[i])==1) ok = false;
		}
		if(ok) chmin(ans, tmp);
	}

	cout << ans << endl;
	// printf("%d\n", N);
	return 0;
}