#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

vec prime;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    reps(i, 2, 51){
        bool pr = true;
        reps(j, 2, i) if(i%j == 0) pr = false;
        if(pr) prime.push_back(i);
    }
    M = 15;
    ll res = INF;
    cin>>N;
    vec a(N);
    rep(i, N) cin>>a[i];
    rep(s, 1<<M){
        ll cmp = 1;
        rep(i, M) if((s>>i)&1) cmp *= prime[i];
        rep(i, N){
            bool ok = false;
            rep(j, M){
                if(((s>>j)&1) && a[i]%prime[j] == 0){
                    ok = true;
                    break;
                }
            }
            if(!ok){
                cmp = -1;
                break;
            }
        }
        if(cmp != -1) chmin(res, cmp);
    }
    cout<<res<<endl;
}
#include<bits/stdc++.h>
using namespace std;
int n, x[50];
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int gcd(long long a, long long b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> x[i];
	long long ans = 0x3f3f3f3f3f3f3f3f;
	for (int i = 0; i < (1<<15); i++) {
		long long val = 1;
		for (int j = 0; j < 15; j++)
			if (i & (1<<j)) val *= prime[j];
		bool flag = 1;
		for (int j = 1; j <= n; j++)
			if (gcd(val, x[j]) == 1) flag = 0;
		if (flag) ans = min(ans, val);
	}
	cout << ans << endl;
}