#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int m = 3e5 + 2;
long long int spf[400005];
void presolve() {
  for (long long int i = 2; i <= m; i++) {
    if (spf[i] == 0) {
      spf[i] = i;
      for (long long int j = 2 * i; j <= m; j += i) {
        spf[j] = i;
      }
    }
  }
}
vector<pair<long long int, long long int> > get_factors(long long int x) {
  vector<pair<long long int, long long int> > ans;
  long long int cnt;
  while (x > 1) {
    cnt = 0;
    long long int p = spf[x];
    while (x % p == 0) x /= p, cnt++;
    ans.emplace_back(make_pair(p, cnt));
  }
  return ans;
}
void solve() {
  long long int n;
  cin >> n;
  map<long long int, vector<long long int> > ids;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    vector<pair<long long int, long long int> > gf = get_factors(x);
    for (auto f : gf) {
      ids[f.first].emplace_back(f.second);
    }
  }
  long long int ans = 1;
  for (auto &k : ids) {
    if (k.second.size() >= n - 1) {
      sort(k.second.begin(), k.second.end());
      if (k.second.size() == n)
        ans *= pow(k.first, k.second[1]);
      else
        ans *= pow(k.first, k.second[0]);
    }
  }
  cout << ans;
}
int32_t main() {
  presolve();
  ios::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  ;
  solve();
}
