#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define pb push_back 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

bool isP(int n) {
    if(n <= 1) return 0;
    for(int i = 2; i*i <= n; i++)
        if(n%i == 0) return 0;
    return 1;
}

int main() {
	std::ios::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
    int x[n];

    for(int i = 0; i < n; i++)
        cin >> x[i];

    vi p;
    ll ans = 1;

    for(int i = 2; i <= 50; i++) {
        if(isP(i)) {
            p.pb(i);
            ans *= i;
        }
    }

    int m = p.size();

    for(int i = 0; i < (1 << m); i++) {
        ll curr = 1;
        for(int j = 0; j < m; j++) {
            if((i >> j)&1) {
                curr *= p[j];
            }
        }

        bool comp = 1;
        for(int j = 0; j < n; j++) {
            if(__gcd((ll) x[j], curr) == 1) comp = 0;
        }

        if(comp) ans = min(ans, curr);
    }

	cout << ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define full(a) memset(a, 0x3f, sizeof(a))
#define fornext(x, i) for(int i = head[x], y = ver[i]; i; i = nxt[i], y = ver[i])
#define mset(a, b) memset(a, b, sizeof(a))
#define Rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define dRep(i, a, b) for(int i = (a); i >= (b); --i)
#define IOset(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout);
#define endl '\n'
#define int ll
#define un unsigned
#define ll long long
#define db double
#define rept cerr<<1.0*clock()/CLOCKS_PER_SEC<<endl;
#define dbg cout<<"c "
#define dbug(x) cerr << #x " = " << (x) << endl
template<typename _T> inline void _prt(_T _d) { cerr << _d << ' '; }
template <typename _T, typename ...Args> inline void _prt(_T _d, Args ..._a) { _prt(_d), _prt(_a...); }
template <typename _T, typename ...Args> inline void prt(_T _d, Args ..._a) { _prt(_d), _prt(_a...), cerr << endl; }
template <typename _T, typename ...Args> inline void prt(_T _d) { cerr << _d << endl; }
template<typename _T> inline void rd(_T &_d) {
	signed _f; char _c; _f = _d = 0; while (_c = getchar(), !isdigit(_c)) _f = _f || (_c == '-');
	while (isdigit(_c)) _d = _d * 10 + _c - '0', _c = getchar();
	_d = (_f ? -_d : _d);
}
template <typename _T, typename ...Args> inline void rd(_T &_d, Args &..._a) { rd(_d); rd(_a...); }

// const int N=
int n,a[55],p[50],d[55],c[55],l=-1;

signed main() {
	rd(n);
	Rep(i,1,n) rd(a[i]);
	int tp,x;
	Rep(i,2,50) {
		tp=sqrt(i),x=i;
		Rep(j,2,tp) while(x%j==0) x/=j;
		if(x==i) p[++l]=i,c[i]=1;
	}	
	++l;
	Rep(i,2,50) {
		Rep(j,0,l-1) if(i%p[j]==0) {
			d[i]|=(1<<j);
		}
		// prt(i,d[i]);
	}
	int win,ans=0;
	// Rep(i,1,n) prt(d[a[i]]);
	Rep(i,0,(1<<l)-1) {
		win=1,tp=1;
		Rep(j,1,n) if(!(d[a[j]]&i)) win=0;
		if(win) {//prt(i);
			Rep(j,0,l-1) if((i>>j)&1) tp*=p[j];
			ans=ans?min(ans,tp):tp;
		}
	}
	cout<<ans<<endl;
    return 0;
}