#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
T gcd(T a, T b)
{
    return b ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a,T b)
{
    return  a / gcd(a,b) * b;
}
#define MAX_N 100005

vector<int> prime;
bool is_prime[MAX_N];

void sieve(int n){
    for(int i=0;i<=n;i++){
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime.push_back(i);
            for(int j=2*i;j<=n;j+=i){
                is_prime[j] = false;
            }
        }
    }
}

int main(){
    sieve(50);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    int m = prime.size();
    ll mi = (1LL<<60);
    rep(i,(1<<m)){
        ll X = 1;
        rep(j,m){
            if((i>>j)&1){
                X *= prime[j];
            }
        }
        bool ng = 0;
        rep(i,n){
            if(gcd(X,a[i])==1){
                ng = 1;
                break;
            }
        }
        if(!ng){
            chmin(mi,X);
        }
    }
    cout << mi << endl;
    return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
#define INF 3000000000000001 // 3e15
#define ll_max 9000000000000000000
#define PI 3.14159265358979323846L
#define fill(a, n, x) for(int i = 0; i < n; i++) a[i] = x;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll N = 200110;
const ll M = log2(N) + 1;

struct point
{
    ll x, y;
};

template<typename T>
T fast_exp(T x,T n)
{
    if(n == 0) return 1;
    T ans = 1;
    if(n % 2 == 0)
    {
         ans = fast_exp(x, n / 2);
         ans = ans * ans % mod;
    }
    else ans = fast_exp(x, n - 1) * x % mod;
    return ans;
}

void update(ll BIT[], ll i, ll x, ll n)
{
    if(i <= 0) return;
    for(; i <= n; i += i & (-i))
        BIT[i] += x;
}

ll query(ll BIT[], ll l, ll r)
{
    l--;
    ll sum = 0;
    while(r > 0)
    {
        sum += BIT[r];
        r = r & (r - 1);
    }
    while(l > 0)
    {
        sum -= BIT[l];
        l = l & (l - 1);
    }
    return sum;
}

ll fact[2], infact[2];
void work()
{
    fact[0] = fact[1] = infact[0] = infact[1] = 1;
    for(ll i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i % mod;
        infact[i] = fast_exp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    if(r > n || r < 0) return 0;
    return fact[n] * infact[n - r] % mod * infact[r] % mod;
}

vector<int> p;
int smfactor[N + 1]; // smallest prime factor
void SoE(int n = N)
{
    bool Primes[n + 1];
    Primes[0] = Primes[1] = 0;
    for(int i = 2; i < n + 1; i++)
        Primes[i] = 1;
    for(int i = 2; i <= n; i++)
    {
       if(Primes[i] == 1)
       {
           p.push_back(i);
           for(int j = i; j <= n; j += i)
           {
               Primes[j] = 0;
               if(smfactor[j] == 0)
                    smfactor[j] = i;
           }
       }
    }
}

int main()
{
    fast;
    int _ = 1, test = 0;
    SoE(50);
    //cin >> _;
    while(_--)
    {
        test++;
        ll n, m = 0, x, y, ans = INF, k, q;
        cin >> n;
        m = p.size();
        ll a[n + 1];
        for(int i = 1; i <= n; i++)
        {
            cin >> a[i];
        }
        y = 1;
        for(int j = 0; j < m; j++) y = y * p[j];
        ans = y;
        for(ll i = 0; i < (1ll << m); i++)
        {
            y = 1;
            for(int j = 0; j < m; j++)
            {
                if(i & (1ll << j))
                {
                    y = y * p[j];
                }
            }
            bool flag = 1;
            for(int j = 1; j <= n; j++)
            {
                if(__gcd(y, a[j]) == 1)
                    flag = 0;
            }
            if(flag)
                ans = min(ans, y);
        }
        cout << ans << "\n";
    }
    return 0;
}
