#include <bits/stdc++.h>
using namespace std;
const int N = 878787;
int n, lp[N + 87];
vector<int> pr, cnt[N + 87];
set<int> s;
void sieve() {
  for (int i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N;
         ++j) {
      lp[i * pr[j]] = pr[j];
    }
  }
}
void yo(int x) {
  while (x != 1) {
    int c = 0, p = lp[x];
    while (x % p == 0) c++, x /= p;
    cnt[p].emplace_back(c);
    s.insert(p);
  }
}
int main() {
  sieve();
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    yo(x);
  }
  long long ans = 1;
  for (int i : s) {
    int x = cnt[i].size();
    if (x <= n - 2) continue;
    sort(cnt[i].begin(), cnt[i].end());
    int c = (x == n) ? cnt[i][1] : cnt[i][0];
    while (c > 0) ans *= 1LL * i, c--;
  }
  printf("%lld", ans);
  return 0;
}
