#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define rep(i, a, b) for(int i = a; i < b; ++i)

int debug = 0;

int n, y, corr = 1, x[100];

main() {
    cin >> n;
    rep(i, 0, n) {
        cin >> x[i];
        int d = 2, ispr = 1;
        while (d * d <= x[i]) {
            if (x[i] % d == 0) {
                ispr = 0;
                break;
            }
            ++d;
        }
        if (ispr) {
            corr *= x[i];
            x[i] = 0;
        }
    }
    rep(i, 0, n) {
        if (x[i] > 0 && __gcd(x[i], corr) > 1) {
            x[i] = 0;
        }
    }
    y = 1;
    while (1) {
        int f = 1;
        rep(i, 0, n) {
            if (x[i] > 0 && __gcd(y, x[i]) == 1) {
                f = 0;
                break;
            }
        }
        if (f) {
            cout << y * corr << '\n';
            return 0;
        }
        y++;
    }
}
  #include<bits/stdc++.h>

/*

shinchanCoder Here!!

*/

using namespace std;

#define endll "\n"
#define pb push_back
#define all(x) begin(x), end(x)
#define allr(x) rbegin(x), rend(x)
#define forn(i,n) for(ll i=0;i<(n);i++)

#define sz(x) (int)(x).size()

#define ff first
#define ss second

#define mpr make_pair

#define len(x) x.length()

#define ll long long
#define ld long double
#define lli long long int

#define mod 1000000007

ll powmod(ll a,  ll b){
    if(b==0){
        return 1 ;
    }
    ll x = powmod(a,b/2);
    x = (x*x)%mod ;
    if(b%2){
        x = (a*x)%mod ;
    }
    return x;
}

ll power(ll x, ll y) {
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}


vector<ll> prm;

void Sieve(ll n) {
  bool prime[n+1];
  memset(prime,true, sizeof(prime));
  for(ll p=2;p*p<=n;p++) {
    if(prime[p]==true) {
      for(ll i=p*p;i<=n;i+=p) {
        prime[i]=false;
      }
    }
  }
  if(!prm.empty()) {
    prm.clear();
  }
  for(ll p=2;p<=n;p++) {
    if(prime[p]) {
      prm.pb(p);
    }
  }
}

ll fact(ll n) {
    ll res = 1;
    for(ll i=2;i<=n;i++) {
        res*=i;
    }
    return res;
}

ll _lcm(ll x,ll y) {
    return x*y/__gcd(x,y);
}

ll _gcd(ll a,ll b) {
    return a%b==0 ? b : _gcd(b,a%b);
}

ll nCr(ll n,ll r) {
    return (ld)fact(n)/(ld)(fact(r)*fact(n-r));
}

ll finres=1e18;

bool isCoPrime(ll z,ll a[],ll n) {
    for(ll i=0;i<n;i++) {
        if(_gcd(a[i],z)==1) {
            return 1;
        }
    }
    return 0;
}

void solve(ll prm[15],ll i,ll res,ll a[],ll n) {
    if(i==15) {
        if(!isCoPrime(res,a,n)) {
            finres=min(finres,res);
        }
        return;
    }
    solve(prm,i+1,res*prm[i],a,n);
    solve(prm,i+1,res,a,n);
}

int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //Sieve(1000000);
    ll prm[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++) {
        cin>>a[i];
    }
    solve(prm,0,1,a,n);
    cout<<finres;
    return 0;
}
