#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<ll> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }

    vector<ll> p { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 };
    int m = p.size();
    ll ans = 1ll << 62;
    for (int bit = 0; bit < (1 << m); ++bit) {
        ll res = 1;
        for (int i = 0; i < m; ++i) {
            if (bit >> i & 1) {
                res *= p[i];
            }
        }
        bool ok = true;
        for (int i = 0; i < n; ++i) {
            ll g = __gcd(res, x[i]);
            if (g == 1) ok = false;
        }
        if (ok) ans = min(ans, res);
    }
    cout << ans << endl;
}

/*Practice.Practice.Practice.
Created: SAADxENCIPHERER*/
#include <bits/stdc++.h>
     
using namespace std;
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define int long long
#define pb push_back
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ll long long    
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = n - 2; i >= 0; i--)
#define repi(i, n) for (ll i = 1; i <= n; i++)
#define repi1(i, n) for (ll i = n; i >= 1; i--)
#define mem(arr, x) memset(arr, x, sizeof(arr))
#define CLOCK cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";    
typedef vector<ll> vi;
typedef vector<char> vc;
#define mp make_pair
#define ss second
#define mod 1000000007
const int MAX = 100005;
const int inf = 1e18;
 
 
int max(int a,int b)
{
  if(a>b)
    return a;
  else 
    return b;
} 
 
 int M, Aq[103];
int P[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
 
void solve()
{ 
    cin >> M;
    int Ans = false;
    int Sz = 15;
    for(int i = 1; i <= M; i++) cin >> Aq[i];
    for(int mask = 1; mask < (1 << Sz); mask++){
        int Res = 1;
        for(int i = 0; i < Sz; i++){
            if(mask & (1 << i)){
                Res *= P[i];
            }
        }
        bool Was = false;
        for(int i = 1; i <= M; i++){
            if(__gcd(Res, Aq[i]) == 1) Was = true;
        }
        if(!Was){
            if(!Ans) Ans = Res;
            else Ans = min(Ans, Res);
        }
    }
    cout << Ans;
}
 
 
 
     
int32_t main()
{
      fast_io;
    int T=1;
 // cin>>T;
    while(T--)
    {  
      solve();
      
     }
 }
