#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long spf[200010];
void seive() {
  for (long long i = 0; i < 200010; ++i) spf[i] = i;
  for (long long i = 2; i < 200010; ++i)
    if (spf[i] == i)
      for (long long j = 2 * i; j < 200010; j += i)
        if (spf[j] == j) spf[j] = i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  if (fopen("inp.txt", "r"))
    freopen("inp.txt", "r", stdin), freopen("out.txt", "w", stdout);
  ;
  seive();
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  vector<long long> g[200010];
  for (long long i = 0; i < n; ++i) {
    long long x = a[i];
    while (x > 1) {
      long long p = spf[x], cnt = 0;
      while (x % p == 0) x /= p, cnt++;
      g[p].push_back(cnt);
    }
  }
  long long ans = 1;
  for (long long i = 0; i < 200010; ++i) {
    long long x = (g[i]).size();
    if (!x) continue;
    sort((g[i]).begin(), (g[i]).end());
    long long y = 0;
    if (x == n - 1) y = g[i][0];
    if (x == n) y = g[i][1];
    ans = ans * pow(i, y);
  }
  cout << ans;
  return 0;
}
