#include<bits/stdc++.h>
#define ll long long
#define re register
#define INF 2147483647
using namespace std;

inline int read()
{
	int f=1,x=0;char s=getchar();
	while(s<'0'||s>'9')
	{
		if(s=='-') f=-1;
		s=getchar();
	}
	while(s>='0'&&s<='9')
	{
		x=x*10+s-48;
		s=getchar();
	}
	return f*x;
}

int pri[20]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47},tot=15;
int a[60],n;
ll ans=1ll<<62;

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

void dfs(int x,ll s)
{
	if(s>ans) return;
	if(x>tot)
	{
		int flag=1;
		for(int i=1;i<=n;i++)
			if(gcd(s,a[i])==1)
			{
				flag=0;
				break;
			}
		if(flag) ans=s;
		return;
	}
	dfs(x+1,s*pri[x]);
	dfs(x+1,s);
}

int main()
{
	n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	dfs(1,1);
	cout<<ans<<endl;
	return 0;
}
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define DEBUG
#ifdef DEBUG
inline void debug_print() { cerr << endl; }
template <typename T1, typename... T2> void debug_print(const T1 a, const T2 &... b) { cerr << a << ' '; debug_print(b...); }
#define debug(...) cerr << __LINE__ << ": [" << #__VA_ARGS__ << "] = " , debug_print(__VA_ARGS__);
#else
#define debug(...) true
#endif

inline void print() { cout << '\n'; }
template <typename T1, typename... T2> void print(const T1 a, const T2 &... b) { cout << a << ' '; print(b...); }

template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto e : v) os << e << ' '; return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) { for (auto e : v) os << e << ' ';  return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &v) { for (auto e : v) os << e << ' ';  return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp) { for (auto e : mp) os << e << ' '; return os; }

template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } else return false; }
template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } else return false; }

//-------------------------- Libraries --------------------------//

vector<long long> sieve(long long N) {
    vector<long long> res;
    vector<long long> is_prime(N+1, true);
    is_prime[0] = is_prime[1] = false;
    for (long long i = 2; i <= N; i++) {
        if (is_prime[i]) {
            res.push_back(i);
            for (long long j = 2 * i; j <= N; j+=i) {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

//---------------------------- Solve ----------------------------//

void solve() {
    int N;
    cin >> N;
    vector<int> X(N);
    int ma = 0;
    for (int i = 0; i < N; i++) {
        cin >> X[i];
        chmax(ma, X[i]);
    }

    auto primes = sieve(ma);
    int n = primes.size();

    long long ans = 1LL<<60;
    for (int bit = 0; bit < 1<<n; bit++) {
        long long tmp = 1;
        vector<int> v;
        for (int i = 0; i < n; i++) {
            if (bit & 1<<i) {
                tmp *= primes[i];
                v.push_back(primes[i]);
            }
        }
        bool flag = true;
        for (int i = 0; i < N; i++) {
            bool flag2 = false; 
            for (auto &&prime : v) {
                if (X[i] % prime == 0) flag2 = true;
            }
            if (!flag2) flag = false;
        }
        if (flag) chmin(ans, tmp);
    }

    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int t = 1;
    //cin >> t;
    while (t--) solve();

    return 0;
}
