#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = long long;
using Graph = vector<vector<int>>;
const long long INF = 1LL << 60;
const int SINF = 1LL << 29;
const ll mod = 1000000000+7;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//最大公約数
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main() {
    int n;
    cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    vector<ll> prime = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
    vector<ll> a;

    for(int bit = 1; bit<(1<<15); bit++) {
        ll f = 1;
        for(int i=0; i<15; i++) {
            if(bit>>i&1) {
                f *= prime[i];
            }
        }
        a.push_back(f);
    }
    sort(all(a));
    for(int i=0; i<a.size(); i++) {
        bool flg = true;
        for(int j=0; j<n; j++) {
            if(gcd(a[i], x[j]) == 1) {
                flg = false;
                break;
            }
        }
        if(flg) {
            cout << a[i] << endl;
            return 0;
        }
    }
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

// THINGS TO REMEMBER
// ENDL is slow, '\n' is fast
// Clear everything (including graphs) between test cases
// use anti-anti-hash: https://codeforces.com/blog/entry/62393
// pb-ds: https://codeforces.com/blog/entry/11080
// check when to use LLONG_MAX/LLONG_MIN vs INT_MAX or INT_MIN
// You frequently suffer from confirmation bias - you trust your initial solution and miss simple things. 
// When you hit a roadblock, remember to rethink the solution ground up, not just try hacky fixes

int main(){
	

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
    vector<ll> primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};

    int n;
    cin>>n;

    int arr[n];
    for(int i=0;i<n;i++){
    	cin>>arr[i];
    }

    ll ans=LLONG_MAX;

    ll tot = 1<<(15);


    for(int i=0;i<tot;i++){
    	ll currNum=1;
    	ll tt = i;

    	for(int j=0;j<15;j++){
    		if(tt&1){
    			currNum*=primes[j];
    		}
    		tt>>=1;
    	}

	    // cerr<<i<<endl;
	    // cerr<<currNum<<endl;

    	bool works=true;
    	for(int j=0;j<n;j++){
    		if(__gcd(currNum, (ll)arr[j])==1){
    			works=false;
    			break;
    		}
    	}
	    cerr<<i<<endl;

    	if(works){
    		ans=min(ans,currNum);
    	}
    }
    cout<<ans<<endl;




}
