#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res *= a, n--;
    a *= a;
    n >>= 1;
  }
  return res;
}
const int MAXN = 2e5 + 10;
int n;
vector<int> deg[MAXN];
void factorize(long long x) {
  for (int i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      int tmpdeg = 0;
      while (x % i == 0) x /= i, tmpdeg++;
      deg[i].push_back(tmpdeg);
    }
  }
  if (x > 1) deg[x].push_back(1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    factorize(x);
  }
  long long ans = 1;
  for (int i = 1; i <= 2e5; ++i) {
    if (!deg[i].empty() && (int)deg[i].size() >= n - 1) {
      sort(deg[i].begin(), deg[i].end());
      int tmpdeg = deg[i][0];
      if ((int)deg[i].size() == n) tmpdeg = deg[i][1];
      ans *= binpow(i, tmpdeg);
    }
  }
  cout << ans;
  return 0;
}
