// Problem: A - Not coprime
// Contest: AtCoder - AtCoder Regular Contest 114
// URL: https://atcoder.jp/contests/arc114/tasks/arc114_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

/* Author : Atahar Islam Shihab
   ICT'16th Batch,MBSTU
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define ll long long
#define maxele(v) *max_element(v.begin(),v.end())
#define minele(v) *min_element(v.begin(),v.end())
#define deb(x) cout << #x << " -> " << x << endl
#define deb2(x, y) cout << #x << " -> " << x << " || " << #y << " -> " << y << endl
#define fast  (ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0))
#define all(v) v.begin(),v.end()
#define sz(x) x.size();
#define clr(x) memset(x, 0, sizeof(x))
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
const int mxn = 100005;
 
int main()
{
  fast;
  int tc ;
  int n;
  cin >> n;
  vector<ll>v(n);
  for(int i=0;i<n;++i){
  	cin >> v[i];
  }
  sort(all(v));
  
  vector<ll>prime;
  
  for(int i=2;i<=50;++i){
  	bool ok = true;
  	for(int j=2;j*j<=i;++j){
  		if (i%j==0) {
  			ok=false;
  			break;
  		}
  	}
  	if (ok) prime.pb(i);
  }
  
  vector<ll>sub;
  for(ll i=0; i< (1<<15) ;++i){
  	ll res=1;
  	for(ll j=0;j<15;++j){
  		if (i&(1<<j)){
  			res*=prime[j];
  		}
  	}
  	if (res>1)
  		sub.pb(res);
  }
  sort(all(sub));

  ll ans=0;
  for(int i=0;i<sub.size();++i){
  	bool ok = true;
  	for(int j=0;j<n;++j){
  		if (__gcd(sub[i],v[j])<2){
  			ok=false;
  			break;
  		}
  	}
  	if (ok){
  		cout << sub[i] <<'\n';
  		break;
  	}
  }
  
  
   
 
 
 
  
 
  return 0;
}

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = j, i##E = k; i <= i##E; i++)
#define R(i, j, k) for(int i = j, i##E = k; i >= i##E; i--)
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int, int>
#define mkp make_pair
#define sz(a) ((int) (a).size())
using namespace std;
const int N = 1e5 + 7;
int n, Prime[N], p[N], tot;
ll a[N], ans = 7e18;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n;
	L(i, 1, n) cin >> a[i];
	L(i, 2, 50) Prime[i] = true;
	L(i, 2, 50) L(j, 2, 50 / i) Prime[i * j] = false;
	L(i, 2, 50) if(Prime[i]) p[++tot] = i;
	L(i, 1, (1 << tot) - 1) {
		ll val = 1;
		L(j, 1, tot) if(i >> (j - 1) & 1) val *= p[j];
		bool ok = true;
		L(j, 1, n) {
			if(__gcd(a[j], val) == 1) {
				ok = false;
				break;
			}
		}
		if(ok) ans = min(ans, val);
	}
	cout << ans << "\n";
	return 0;
}