#include <bits/stdc++.h> 
using namespace std;
const int p[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int n,x[55];
long long ans=1e18;

void dfs(int i,long long j) {
	if (i==15) {
		for (int i=1; i<=n; ++i)
			if (__gcd((long long)x[i],j)==1) return;
		ans=min(ans,j); return;
	}
	dfs(i+1,j);
	dfs(i+1,j*p[i]);
}

int main() {
	cin>>n;
	for (int i=1; i<=n; ++i) cin>>x[i];
	dfs(0,1);
	cout<<ans;
}
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define int ll
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb emplace_back
#define pii pair<int , int>
#define F first
#define S second
const int mod = 1000000007;
const int MAXX = 1e5 + 5;

int t , n;
int x[MAXX];

int gcd(int a , int b){
    return (a ? gcd(b % a , a) : b);
}

signed main()
{
    _FastIO;
    cin >> n;
    int a[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
    vector<int> v;
    for(int i = 1; i < (1 << 15); i++){
        int k = 1;
        for(int j = 0; j < 15; j++){
            if(i & (1 << j)){
               k *= a[j];
            }
        }
        v.pb(k);
    }
    sort(v.begin() , v.end());
    map<int , bool> m;
    int ans = 1;
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    for(int i = 0; i < v.size(); i++){
        bool f = true;
        for(int j = 0; j < n; j++){
            if(gcd(v[i] , x[j]) == 1)
                f = false;
        }
        if(f){
            cout << v[i] << endl;
            return 0;
        }
    }
    return 0;
}
