#include <bits/stdc++.h>
#pragma GCC target("avx2")
using namespace std;
const int maxn = 1e5 + 13;
const int maxa = 2e5 + 37;
map<int, int> factors[maxa];
bool prime[maxa];
int a[maxn];
int deg(int j, int i) {
  int res = 0;
  while (j % i == 0) {
    ++res;
    j /= i;
  }
  return res;
}
void precalc() {
  for (int i = 2; i < maxa; ++i) prime[i] = 1;
  factors[1][1] = 1;
  for (int i = 2; i < maxa; ++i) {
    if (prime[i]) {
      factors[i][i] = 1;
      for (int j = 2 * i; j < maxa; j += i) {
        prime[j] = 0;
        factors[j][i] = deg(j, i);
      }
    }
  }
}
int64_t pow_bin(int x, int y) {
  int64_t res = 1, t = x;
  while (y) {
    if (y & 1) res *= t;
    t *= t;
    y >>= 1;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  precalc();
  int n;
  cin >> n;
  map<int, vector<int> > cnt;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (auto pr : factors[a[i]]) cnt[pr.first].push_back(pr.second);
  }
  int64_t res = 1;
  for (auto &pr : cnt) {
    if (int(pr.second.size()) >= n - 1) {
      sort(pr.second.begin(), pr.second.end());
      if (int(pr.second.size()) == n)
        res *= pow_bin(pr.first, pr.second[1]);
      else
        res *= pow_bin(pr.first, pr.second[0]);
    }
  }
  cout << res << '\n';
}
