#include <bits/stdc++.h>
const int maxn = 2e5 + 20;
const int maxm = 1e5 + 10;
const long long int mod = 1e9 + 7;
const long long int INF = 1e18 + 100;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-8;
using namespace std;
std::vector<int> v[maxn];
long long int qpow(long long int a, long long int n) {
  long long int res = 1;
  while (n) {
    if (n & 1) res *= a;
    a *= a;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    map<int, int> ma;
    int x;
    scanf("%d", &x);
    for (int j = 2; j * j <= x; j++) {
      while (x % j == 0) ma[j]++, x /= j;
    }
    if (x != 1) ma[x]++;
    for (auto it : ma) {
      v[it.first].push_back(it.second);
    }
  }
  long long int ans = 1;
  for (int i = 1; i <= 2e5; i++) {
    if (v[i].size()) {
      if ((int)v[i].size() < n - 1)
        v[i].clear();
      else
        sort(v[i].begin(), v[i].end());
    }
  }
  for (long long int i = 1; i <= 2e5; i++) {
    if (!v[i].size()) continue;
    if ((int)v[i].size() == n)
      ans *= qpow((long long int)i, (long long int)v[i][1]);
    else if ((int)v[i].size() == n - 1)
      ans *= qpow((long long int)i, (long long int)v[i][0]);
  }
  printf("%lld\n", ans);
}
