#include<bits/stdc++.h>
#include<iostream>
#define mi map<int,int>
#define umi unordered_map<int,int>
#define pii pair<int,int>
#define si  set<int>
#define st stack<int>
#define di deque<int>
#define qi queue<int> 
#define pq priority_queue<int>
#define dl deque<long long int>
#define usi unordered_set<int>
#define vi vector<int>
#define vl vector<long long int>
#define ll long long int
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define M1 1000000007
#define M2 998244353
#define I1 1000000001
#define I2 1000000000000000001
#define asort(v) sort(v.begin(),v.end())
#define dsort(v) sort(v.begin(),v.end(),greater<int>())
using namespace std;
ll gcd(ll a,ll b){if(b==0) return a;else return gcd(b,a%b);}

bool isprime(ll a){for(int i=2;i<=sqrt(a);i++){if(a%i==0) return false;} return true;}

ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

// the number of zeros at the beginning of the bit representation //

int prefixzero(int x) {return __builtin_clz(x);}

// the number of zeros at the end of the bit representation //
int suffixzero(int x) {return __builtin_ctz(x);}

// the number of ones in the bit representation //
int numberone(int x) {return __builtin_popcount(x);}
// push the value of array element //

void read(vector<int> &v,int n) {for(int i=0;i<n;i++) cin>>v[i];}

void read_1(vector<int> &v,int n) {for(int i=1;i<=n;i++) cin>>v[i];}

void read_l(vector<ll> &v,ll n) {for(ll i=0;i<n;i++) cin>>v[i];}

// to check the given number prime or not //
vector<bool>prime(1e6+1,true);
void sprime()
{
  prime[0]=false;
  prime[1]=false;
  for(ll i=2;i<=sqrt(1e6);i++)
  {
    if(prime[i])
    { 
      for(ll j=i*i;j<=1e6;j+=i) prime[j]=false;
    }
  }
}

// return the value of x and y in given equation of ax+by=gcd(a,b) //
tuple<int,int,int> GCD(int a,int b)
{
  if(b==0) return {1,0,a};
  else
  {
    int x,y,g;
    tie(x,y,g)=GCD(b,a%b);
    return {y,x-(a/b)*y,g};
  }
}
// to find the power of given number in logn time //
ll pw(ll base,ll power)
{
  ll res=1;
  while(power!=0)
  {
    if(power&1) {power-=1;res=(res*base);}
    else {power/=2;base=(base*base);}
  }
  return res;
}
// dfs traversal for graph and find the minimum distance from root node //
/*void dfs(int node,int d)
{
  visit[node]=1;
  dist[node]=d;
  for(int child:ar[node])
  {
    if(visit[child]==0) dfs(child,dist[node]+1);
  }
}*/

// bfs traversal for graph and find the minimum distance from root node //
/*void bfs(int node)
{
  queue<int>q;
  q.push(node);
  visit[node]=1;
  dist[node]=0;
  while(!q.empty())
  {
    int curr=q.front();
    q.pop();
    for(int child:ar[curr])
    {
      if(visit[child]==0)
      {
        q.push(child);
        dist[child]=dist[curr]+1;
        visit[child]=1;
      }
    }
  }
}*/

//---------------------------------START THE CODE------------------------------//
void solve()
{
  int n;cin>>n;
  vi v(n);
  read(v,n);
  vl prime={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
  ll ans=1e18;
  for(ll i=0;i<(1<<prime.size());i++)
  {
    ll num=1;
    for(int j=0;j<prime.size();j++)
    {
      if(i>>j & 1) num*=prime[j];
    }
    bool p=true;
    for(int i=0;i<n;i++)
    {
      if(gcd(v[i],num)==1)
      {
        p=false;
        break;
      }
    }
    if(p)
    {
      ans=min(ans,num);
    }
  }
  cout<<ans<<"\n";
  return;
}
int main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t=1;//cin>>t;
    while(t--) {solve();}
  return 0;
}
/*-----------------END OF CODE------------------*/
#include <bits/stdc++.h>

using namespace std ;

#define int int64_t 
#define endl "\n"
#define f(i,a,b) for(int i=int(a);i<int(b);++i)

#define pr pair
#define ar array
#define fr first
#define sc second
#define vt vector
#define pb push_back
#define LB lower_bound  
#define UB upper_bound
#define PQ priority_queue

#define sz(x) ((int)(x).size())
#define all(a) (a).begin(),(a).end()
#define allr(a) (a).rbegin(),(a).rend()
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))

template<class A> void rd(vt<A>& v);
template<class T> void rd(T& x){ cin >> x; }
template<class H, class... T> void rd(H& h, T&... t) { rd(h) ; rd(t...) ;}
template<class A> void rd(vt<A>& x) { for(auto& a : x) rd(a) ;}

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

template<typename T>
void __p(T a) {
  cout<<a; 
}
template<typename T, typename F>
void __p(pair<T, F> a) {
  cout<<"{";
  __p(a.first);
  cout<<",";
  __p(a.second);
  cout<<"}\n"; 
}
template<typename T>
void __p(std::vector<T> a) {
  cout<<"{";
  for(auto it=a.begin(); it<a.end(); it++)
    __p(*it),cout<<",}\n"[it+1==a.end()]; 
}
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
  __p(a1);
  __p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cout<<name<<" : ";
  __p(arg1);
  cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  int bracket=0,i=0;
  for(;; i++)
    if(names[i]==','&&bracket==0)
      break;
    else if(names[i]=='(')
      bracket++;
    else if(names[i]==')')
      bracket--;
  const char *comma=names+i;
  cout.write(names,comma-names)<<" : ";
  __p(arg1);
  cout<<" | ";
  __f(comma+1,args...);
}

void setIO(string s = "") {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
  cin.exceptions(cin.failbit); 
	cout.precision(15);	cout << fixed;
  if(sz(s)){
    freopen((s+".in").c_str(),"r",stdin);
    freopen((s+".out").c_str(),"w",stdout);
  }
}
const vt<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
const int N = sz(primes);
signed main(){
  setIO() ;
  int n; rd(n);
  vt<int> a(n); rd(a);
  int ans = 2e18;
  for(int mask = 1; mask < (1<<N); mask++){
  	int cur = 1 ;
  	f(i,0,N) if(mask & (int(1) << i)) cur *= primes[i] ;
  	bool ok = true ;
  	f(i,0,n) ok &= __gcd(cur,a[i]) > 1 ;
  	if(ok){
  		ckmin(ans,cur);
  	}
  }
  cout << ans;
}

