#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
ll gcd(ll x, ll y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
void solve() {
  int n;
  cin >> n;
  vi a(n + 1), pre(n + 1), suf(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  pre[1] = a[1], suf[n] = a[n];
  for (int i = 2; i <= n; i++) pre[i] = gcd(pre[i - 1], a[i]);
  for (int i = n - 1; i >= 1; i--) suf[i] = gcd(suf[i + 1], a[i]);
  ll ans = 0;
  for (int i = 0; i <= n - 1; i++) {
    if (i == 0)
      ans = suf[2];
    else if (i == n - 1)
      ans = ans * pre[n - 1] / gcd(pre[n - 1], ans);
    else
      ans = ans * gcd(pre[i], suf[i + 2]) / gcd(gcd(pre[i], suf[i + 2]), ans);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
}
