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

int main()
{
    ll n;
    cin >> n;
    vector<ll> x(n);
    rep(i,n) cin >> x[i];
    vector<ll> ps = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
    ll ans = LONG_LONG_MAX;
    for(int i = 0; i < 1 << ps.size(); i++){
        bitset<20> bs(i);
        bool ok = true;
        rep(j,n){
            bool sub = false;
            rep(k,(int)ps.size()){
                if(bs[k]){
                    if(x[j] % ps[k] == 0) {
                        sub = true;
                        break;
                    }
                }
            }
            if(sub==false) ok = false;
            if(!ok) break;
        }
        if(ok){
            ll sum = 1;
            rep(k,(int)ps.size()){
                if(bs[k]){
                    sum *= ps[k];
                }
            }
            ans = min(ans, sum);
        }
    }
    cout << ans << endl;
    
    return 0;
}
# include <bits/stdc++.h>
# define sz(x) (int)x.size()
# define f first
# define s second
 
using namespace std;
using ll = long long;
 
int cnt[55], a[55], n;
ll ans;
set<int> f[55];
 
void calc(int in) {
  int x = a[in];
  for (int i = 2; i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      //cout << "HERE";
      f[in].insert(i);
    }
  }
  for (auto i : f[in]) cnt[i]++;
}
 
void solve() {
  cin >> n;
  ans = 1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    calc(i);
  }
  vector<int> used(55);
  // for (int i = 0; i < 55; ++i) cout << cnt[i] << ' ';
  // cout << '\n';
  for (int i = 0; i < n; ++i) {
    bool ok = 0;
    for (auto j : f[i]) {
      if (ans % j == 0) ok = 1;
    }
    if (ok) {
      for (auto j : f[i]) cnt[j]--;
      continue;
    } 
    int res = 0, x = 1;
    for (auto j : f[i]) {
      if (cnt[j] > res) {
        res = cnt[j];
        x = j;
      }
    }
    ans *= x;
    for (auto j : f[i]) cnt[j]--;
  }
  cout << ans;
}
 
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t; cin >> t; while (t--) 
  solve();
}