#include <iostream>
#include <cstdio>
#include <vector>
#define N 55
using namespace std;

typedef long long ll;
ll n, ans = 1e18, a[N];
bool vpr[N];
vector<ll> pr;

ll gcd(ll p, ll q) {
	if (q == 0) return p;
	return gcd(q, p % q);
}

void f(ll p, ll q) {
	ll i;
	if (q >= ans) return;
	if (p == pr.size()) {
		for (i = 0; i < n; i++) {
			if (gcd(q, a[i]) == 1) return;
		}
		ans = q;
		return;
	}
	f(p + 1, q);
	f(p + 1, q * pr[p]);
}

int main()
{
	ll i, j;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}
	for (i = 2; i <= 50; i++) {
		if (vpr[i]) continue;
		pr.push_back(i);
		for (j = i * 2; j <= 50; j += i) {
			vpr[j] = 1;
		}
	}
	f(0, 1);
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,srt,end) for(ll i = (srt); i < (ll)(end); i++)
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
//cout << std::fixed << std::setprecision(15) << y << endl;

// For debug
// Ref: https://qiita.com/ysuzuki19/items/d89057d65284ba1a16ac
#define dump(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << "\n";}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << "\n";}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ std::cerr << "\n"; for(const auto& v : vv){ view(v); } }
template<typename T> void dump_cout(const T& v) { for(long long i = 0; i < v.size(); i++) std::cout << v[i] << (i == v.size()-1 ? "\n" : " "); }
// 約数列挙
vector<ll> yakusu(ll n){
    vector<ll> ret;
    for(ll i = 1; i*i <= n; i++){
        if(n % i != 0) continue;
        ret.push_back(i);
        if(i*i != n) ret.push_back(n/i);
    }
    sort(ret.begin(), ret.end());
    return ret;
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0){
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

// 最大公約数
// 結合法則も成り立つ
ll gcd(ll a, ll b){
    if(a < b) return gcd(b, a);
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    vector<ll> x(n);
    rep(i,0,n) cin >> x[i];

    vector<ll> px;
    rep(i,2,51) if(IsPrime(i)) px.push_back(i);

    dump(px);
    ll ans = INF;
    for(int i = 0; i < (1<<px.size()); i++){
        ll y = 1;
        for(int j = 0; j < px.size(); j++) if(i & (1<<j)) y *= px[j];
        bool f = true;
        if(y != 1){
            rep(i,0,n){
                if(gcd(x[i], y) != 1) f *= true;
                else f *= false;
            }
        }else f = false;             
        if(f) ans = min(ans, y);
    }
    cout << ans << endl;
    return 0;
}