#include <bits/stdc++.h>
#define ll long long
#define B break
#define C continue
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define gc getchar
#define pc putchar
#define kg putchar(' ')
#define hh putchar('\n')
#define mem(a,b) memset(a,b,sizeof(a))
#define _for(i,a,b) for( int i=(a); i<=(b); i++)
#define _rep(i,a,b) for( int i=(a); i>=(b); i--)
//#define int __int128
#define int long long
using namespace std;
inline int rd(){
    int x=0,f=1;char ch=gc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=gc();}
    return x*f;
}
char chhh[200];
inline void rt(int x){
    int cnt=0,tmp=x>0?x:-x;
    if (!x) {pc('0');return;}
    if(x<0) pc('-');
    while(tmp>0) {chhh[cnt++]=tmp%10+'0';tmp/=10;}
    while(cnt>0) pc(chhh[--cnt]);
}
int a[110]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,0,0},b[110]; 
int ans=0,n;
void dfs(int k,int x){
	if(!a[k]){
		int i;
		for(i=1;i<=n;i++){
			if(__gcd(x,b[i])==1) break;
		}
		if(i==n+1){ 
			if(!ans){
				ans=x;
			}
			else{
				ans=min(ans,x);
			}
		}
	}
	else{
		dfs(k+1,x);
		dfs(k+1,x*a[k]);
	}
}
signed main(){
//int main(){
	//int t;
	//t=rd();
	//while(t--){n=rd();
	n=rd();
	_for(i,1,n){
		b[i]=rd();
	}
	dfs(1,1);
	rt(ans);




	//}

    return 0;
}




#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;

int main() {
	long long N; cin >> N;
	long long X[60]; for (int i = 0; i < N; i++) cin >> X[i];

	long long prime[30];
	prime[0] = 2;
	prime[1] = 3;
	prime[2] = 5;
	prime[3] = 7;
	prime[4] = 11;
	prime[5] = 13;
	prime[6] = 17;
	prime[7] = 19;
	prime[8] = 23;
	prime[9] = 29;
	prime[10] = 31;
	prime[11] = 37;
	prime[12] = 41;
	prime[13] = 43;
	prime[14] = 47;

	int n = 15;
	long long min_ = 1LL << 60;
	
	for (int bit = 0; bit < (1 << n); ++bit) {
		vector<int> S;
		for (int i = 0; i < n; ++i) {
			if (bit & (1 << i)) { // 列挙に i が含まれるか
				S.push_back(i);
			}
		}
		bool flag[60];
		for (int i = 0; i < N; i++) flag[i] = false;
		long long count = 1;
		for (int i = 0; i < (int)S.size(); ++i) {
			count *= prime[S[i]];
			for (int j = 0; j < N; j++) {
				if (X[j] % prime[S[i]] == 0) flag[j] = true;
			}
		}
		bool flag_ = true;
		for (int i = 0; i < N; i++) if (flag[i] == false) flag_ = false;
		if (flag_) min_ = min(count, min_);
	}
	cout << min_ << endl;
}