//#include<bits/stdc++.h>
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
//namespace first_space
//{
//	int a=10;
//	void func()
//	{
//		cout << "Inside first_space" << endl;
//	}
//}
int read()
{
	int res=0,ch,flag=0;
	if((ch=getchar())=='-')             //判断正负
		flag=1;
	else if(ch>='0'&&ch<='9')           //得到完整的数
		res=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')
		res=res*10+ch-'0';
	return flag?-res:res;
}

typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 5;

int n, m, _, k, cas;
ull a[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
int b[N];
signed main()
{
	int ans1=0;
	int ans2=0;
	int ans3=0;
	ans1=ans2=ans3=0;
	cin >> n;	ans1=ans2=ans3=0;
	rep (i, 1, n+ans1+ans2+ans3) cin >> b[i];
	ull ans = 0;	ans1=ans2=ans3=0;
	rep (i, 1, (1 << 15) - 1)
	{	ans1=ans2=ans3=0;
		bool f = 1;
		rep (j, 1, n+ans1+ans2+ans3)
		{	ans1=ans2=ans3=0;
			bool g = 0;	ans1=ans2=ans3=0;
			rep (k, 0, 14) if ((i >> k & 1) && b[j] % a[k] == 0) g = 1;
			if (!g)
			{
				f = 0;	ans1=ans2=ans3=0;	ans1=ans2=ans3=0;
				break;	ans1=ans2=ans3=0;
			}
		}
		if (!f) continue;
		ull cur = 1+ans1+ans2+ans3;	ans1=ans2=ans3=0;
		rep (j, 0, 14) if (i >> j & 1) cur *= a[j]+ans1+ans2+ans3;
			ans1=ans2=ans3=0;
		if (!ans) ans = cur;
		else ans=min(ans,cur);
	}
	cout << ans;
}

#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int N = 2e5 + 7;
int a[N];
bool vis[50];
int p[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int main() {
	int n;
	cin >> n;
	long long ans = 1e18;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	for(int i = 1; i < 1 << 15; ++i) {
		bool suc = 1;
		//ll res = 1;
		for(int j = 1; j <= n; ++j) {
			bool ok = 0;
			for(int k = 0; k < 15; ++k) {
				if(i >> k & 1) {
					if(a[j] % p[k] == 0) {
						ok = 1;
						break;
					}
				}
			}
			suc &= ok;
			//cout <<res << endl;
		}
		if(suc) {
			ll res = 1;
			for(int k = 0; k < 15; ++k) {
				if(i >> k & 1) res *= p[k];
			}
			ans = min(ans, res);
		}
	}
	print(ans);
}