#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, a) for(int i=0;i<a;i++)
#define repA(i,a,b) for(int i=a;i<b;i++)
#define l list
#define v vector
#define u_m unordered_map
#define itr iterator
#define nm(a) numeric_limits<a>::max()
typedef long long ll;
const int mxN=2e5;
ll n,arr[mxN],prime[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
ll best(bool choose[15],int index){
	if(index==15){
		for(ll i=0;i<n;i++){
			bool did=0;
			for(ll j=0;j<15;j++){
				if(choose[j]&&arr[i]%prime[j]==0){
					did=1;
					break;
				}
			}
			if(did==0)return numeric_limits<ll>::max();
		}
		ll idk=1;
		rep(i,15){if(choose[i])idk*=prime[i];}
		return idk;
	}
	choose[index]=0;
	ll ans=best(choose,index+1);
	choose[index]=1;
	return min(ans,best(choose,index+1));
}		
void solve(){
	cin>>n;
	rep(i,n)cin>>arr[i];
	bool empty[15];
	memset(empty,0,sizeof(empty));
	cout<<best(empty,0)<<endl;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	/*#ifnef ONLINEJUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	*/
	while(t--){
		solve();
	}
	return 0; 
}


#include <bits/stdc++.h>

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i, a) for (int i = 0; i < (a); i++)
#define repr(i, a) for (int i = (int)(a)-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si()
{
  int x;
  scanf("%d", &x);
  return x;
}
long long sl()
{
  long long x;
  scanf("%lld", &x);
  return x;
}
string ss()
{
  string x;
  cin >> x;
  return x;
}
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint
{
  int n;
  mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b)
{
  a.n += b.n;
  if (a.n >= MOD)
    a.n -= MOD;
  return a;
}
mint operator-(mint a, mint b)
{
  a.n -= b.n;
  if (a.n < 0)
    a.n += MOD;
  return a;
}
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

string s, t, u;
int a, b, result;

int main()
{
  cin >> a >> b;
  if (a + b >= 15 && b >= 8)
    result = 1;
  else if (a + b >= 10 && b >= 3)
    result = 2;
  else if (a + b >= 3)
    result = 3;
  else
    result = 4;

  cout << result << endl;
}
