#include <bits/stdc++.h>
using namespace std;
int xx[] = {0, 0, -1, 1, -1, 1, -1, 1}, yy[] = {-1, 1, 0, 0, -1, -1, 1, 1};
using ll = long long;
using ppi = pair<int, int>;
using ppl = pair<ll, ll>;
template <typename T>
using vi = vector<T>;
template <typename T>
using vvi = vector<vector<T>>;
ll p(ll v, int k) {
  ll ret = 1;
  while (k--) {
    ret *= v;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  map<int, vi<int>> ccofprime;
  for (long long i = (0); i < (N); ++i) {
    int v;
    cin >> v;
    for (int i = 2; i * i <= v; ++i) {
      if (v % i == 0) {
        ccofprime[i].push_back(0);
        while (v % i == 0) {
          ccofprime[i].back() += 1;
          v /= i;
        }
      }
    }
    if (1 < v) {
      ccofprime[v].push_back(1);
    }
  }
  ll ans = 1;
  for (auto& v : ccofprime) {
    if (((int)(v.second.size())) < N - 1) continue;
    sort(v.second.begin(), v.second.end());
    if (((int)(v.second.size())) == N - 1) {
      ans *= p(v.first, v.second[0]);
    } else {
      ans *= p(v.first, v.second[1]);
    }
  }
  cout << ans;
  return 0;
}
