#include<bits/stdc++.h>
using namespace std;

int read();
#define LL long long
#define fr(i,l,r) for(int i = (l);i <= (r);++i)
#define rf(i,l,r) for(int i = (l);i >= (r);--i)
#define fo(i,l,r) for(int i = (l);i < (r);++i)
#define foredge(i,u,v) for(int i = fir[u],v;v = to[i],i;i = nxt[i])
#define ci const int &
#define cl const LL &
#define I inline void
#define filein(File) freopen(File".in","r",stdin)
#define fileout(File) freopen(File".out","w",stdout)

const int N = 105;
const int p[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int n,a[N],cnt[N];
int gcd(int x,int y) {
	return !y ? x : gcd(y,x % y);
}
LL now = 1,ans = 9e18;
I chk() {
	fr(i,1,n) if(gcd(now % a[i],a[i]) == 1) return;
	ans = min(ans,now);
}
void dfs(int cur) {
	if(cur == 15) return chk();
	dfs(cur + 1);
	now *= p[cur];
	dfs(cur + 1);
	now /= p[cur];
}
int main() {
	cin >> n;
	fr(i,1,n) cin >> a[i];
	dfs(0);
	cout << ans << endl;
	return 0;
}
/**
 *    Author : Tanbin_Hasan
 *    Created : 14.03.2021
**/
#include <bits/stdc++.h>

using namespace std ;

void subsets(vector<long long> &ar , int n , vector<long long> &d) {
  for (int mask = 0 ; mask < (1LL << n) ; ++mask) {
    vector<long long> temp ;
    for (int i = 0 ; i < n ; ++i) {
      if (mask & (1LL << i)) {
        temp.push_back(ar[i]) ;
      }
    }
    long long res = 1 ;
    if (!temp.empty()) {
      for (auto &i : temp) {
        res *= i ;
      }
      d.push_back(res) ;
    }
  }
}

int main(void) {
  ios::sync_with_stdio(false) ; cin.tie(0) ;
  vector<long long> prime = {2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47} ;
  int n ;
  cin >> n ;
  vector<long long> v(n) ;
  unordered_set<long long> us ;
  for (auto &i : v) {
    cin >> i ;
    for (auto &p : prime) {
      if (!(i % p)) {
        us.insert(p) ;
      }
    }
  }
  vector<long long> fact ;
  vector<long long> d ;
  for (auto &i : us) {
    fact.push_back(i) ;
  }
  subsets(fact , (int) fact.size() , d) ;
  long long res = LONG_LONG_MAX ;
  for (auto &i : d) {
    int cnt = 0 ;
    for (auto &j : v) {
      if (__gcd(i , j) != 1) {
        ++cnt ;
      }
    }
    if (cnt == n) {
      res = min(res , i) ;
    }
  }
  cout << res << '\n' ;
  return 0 ;
}