#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200005;
vector<long long> byk[MAXN];
long long pangkat(long long x, long long y) {
  long long ret = 1;
  for (long long i = 1; i <= y; i++) ret *= x;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, a;
  cin >> n;
  for (long long no = 1; no <= n; no++) {
    cin >> a;
    for (long long i = 2; i * i <= a; i++) {
      long long pa = 0;
      while (a % i == 0) {
        pa++;
        a /= i;
      }
      if (pa) byk[i].push_back(pa);
    }
    if (a > 1) byk[a].push_back(1);
  }
  long long ans = 1;
  for (long long i = 1; i <= 200000; i++) {
    if (byk[i].size() > n - 2) {
      sort(byk[i].begin(), byk[i].end());
      if (byk[i].size() == n - 1)
        ans *= pangkat(i, byk[i][0]);
      else
        ans *= pangkat(i, byk[i][1]);
    }
  }
  cout << ans << '\n';
  return 0;
}
