#include <bits/stdc++.h>
#define fi first
#define se second
#define gc getchar() //(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define IT iterator
#define V vector
#define TP template <class o>
#define TPP template <typename t1, typename t2>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define REP(i, a, b) for (int i = b; i >= a; i--)
#define FOR(i, n) rep(i, 1, n)
#define debug(x) cerr << #x << ' ' << '=' << ' ' << x << endl
using namespace std;
typedef unsigned ui;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
const int N = 55, size = 1 << 20, mod = 998244353, inf = 2e9;
const ll INF = 1e15;

// char buf[size],*p1=buf,*p2=buf;
TP void qr(o& x) {
    char c = gc;
    x = 0;
    int f = 1;
    while (!isdigit(c)) {
        if (c == '-')
            f = -1;
        c = gc;
    }
    while (isdigit(c))
        x = x * 10 + c - '0', c = gc;
    x *= f;
}
template <class o, class... O> void qr(o& x, O&... y) {
    qr(x);
    qr(y...);
}
TP void qw(o x) {
    if (x / 10)
        qw(x / 10);
    putchar(x % 10 + '0');
}
TP void pr1(o x) {
    if (x < 0)
        x = -x, putchar('-');
    qw(x);
    putchar(' ');
}
template <class o, class... O> void pr1(o x, O... y) {
    pr1(x);
    pr1(y...);
}
TP void pr2(o x) {
    if (x < 0)
        x = -x, putchar('-');
    qw(x);
    putchar(10);
}
template <class o, class... O> void pr2(o x, O... y) {
    pr2(x);
    pr2(y...);
}

TP void cmax(o& x, o y) {
    if (x < y)
        x = y;
}
TP void cmin(o& x, o y) {
    if (x > y)
        x = y;
}
TPP void ad(t1& x, t2 y) {
    x += y;
    if (x >= mod)
        x -= mod;
}
TPP void dl(t1& x, t2 y) {
    x -= y;
    if (x < 0)
        x += mod;
}

int n, p[N], a[N], tot;
ll ans = 1e18;
bool v[N], cho[N];

void dfs(int x, ll y) {
    if (y >= ans)
        return;
    if (x == tot + 1) {
        FOR(i, n) if (__gcd((ll)a[i], y) == 1) return;
        ans = y;
        return;
    }
    dfs(x + 1, y * p[x]);
    dfs(x + 1, y);
}

void solve() {
    n = 50;
    rep(i, 2, n) if (!v[i]) {
        for (int j = i * i; j <= n; j += i)
            v[j] = 1;
    }
    qr(n);
    FOR(i, n) {
        qr(a[i]);
        int x = a[i];
        for (int j = 2; j <= x; j++)
            if (x % j == 0) {
                while (x % j == 0)
                    x /= j;
                if (!cho[j])
                    cho[j] = 1, p[++tot] = j;
            }
    }
    dfs(1, 1);
    pr2(ans);
}

int main() {
    int T = 1;
    // qr(T);
    while (T--)
        solve();
    return 0;
}

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
ll INF = 2e18;
using namespace std;

int N;
ll ans=INF;
set<int> s;
vector<int> v;
int list[16] = {2,3,5,7,11,13,17,19,23,29,31,37,39,41,43,47} ;

void regP(int a){
	for(int e:s){
		if(a % e == 0)return;
	}
	for(int i = 2;i*i<=a;i++){
		if(a%i == 0){
			s.insert(i);
			s.insert(a/i);
			return;
		}
	}
	s.insert(a);
}

ll calc(int a){
	ll ret =1;
	for(int i=0;i<16;i++ ){
		if( a & (1<<i)) ret*=list[i];
	}
	return ret;
}
bool isOk(ll a,ll b){
	for(int i = 2; i < 50;i++){
		if(a % i == 0&& b % i == 0){
			return true;
		}
	}
	return false;
}
int main() {
	cin >> N;
	rep(i,N) {
		int a;
		cin >> a;
		v.push_back(a);
	}
	//cout << calc(0x1000);
	for(int i = 1;i<=0xffff;i++){
		int flag = 0;
		ll temp = calc(i);
		for(int e:v){
			if(!isOk(temp,e)){
				flag = 1;
				break;
			}
		}
		if(flag == 1) continue;
		if(ans > temp) ans = temp;
	}
	cout << ans;
	return 0;

}


