#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(void){
    ll N, ans;
    vector<int> P;

    cin >> N;
    P.resize(N + 1);

    ans = 1;
    for (int i = N; i > 1; i--){
        int tmp = i;
        for (int j = 2; j * j <= i; j++){
            int cnt = 0;

            while (tmp % j == 0){
                cnt++;
                tmp /= j;
            }

            P[j] = max(P[j], cnt);
        }

        P[tmp] = max(P[tmp], 1);
    }
    
    ans = 1;
    for (int i = 2; i <= N; i++){
        for (int j = 0; j < P[i]; j++) ans *= i;
    }
    ans += 1;
    
    cout << ans << endl;

    return 0;
}

#include<bits/stdc++.h>
#define mx                          100005
#define lli                         long long int
#define ulli                        unsigned long long int
#define mset(a,b)                   memset(a, b, sizeof(a))
#define infile                      freopen("in.txt", "r", stdin);
#define outfile                     freopen ("out.txt","w",stdout);
#define fileclose                   fclose (stdin); fclose (stdout);
#define test_case                   lli T; cin>>T;for(lli t=1;t<=T;t++)
#define scani(x)                    scanf("%d",&x);
#define printi(x)                   printf("%d\n",x);
#define scanli(x)                   scanf("%lld",&x);
#define printli(x)                  printf("%lld\n",x);
#define frep(i,from,to)             for(lli i=from;i<=to;i++)
#define frev(i,from,to)             for(lli i=from;i>=to;i--)

using namespace std;

lli n;
lli arr[50];

lli ans = 1e18;
lli prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
bool isSet(lli num, lli pos)
{
	return (num & (1 << pos));
}
void fun()
{
	frep(mask, 0, (1 << 15) - 1)
	{
		lli num = 1;
		frep(pos, 0, 15)
		{
			if (isSet(mask, pos))
			{
				num *= prime[pos];
			}
		}
		bool flag = true;
		frep(i, 1, n)
		{
			if (__gcd(num, arr[i]) == 1)
			{
				flag = false;
				break;
			}
		}
		if (flag)
			ans = min(ans, num);
	}


}
int main()
{

	cin >> n;
	frep(i, 1, n)
	{
		cin >> arr[i];
	}
	fun();
	cout << ans << "\n";

}




