#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 12;
long long n, a[N], x;
int p[N];
vector<int> d[N];
void solve() {
  for (int i = 1; i < N; i++) p[i] = i;
  for (long long i = 2; i < N; i++) {
    if (p[i] == i)
      for (long long j = i * i; j < N; j += i)
        if (p[j] == j) p[j] = i;
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    x = a[i];
    map<int, int> m;
    while (x != 1) m[p[x]]++, x /= p[x];
    for (auto it : m) d[it.first].push_back(it.second);
  }
  long long ans = 1;
  for (long long i = 1; i < N; i++) {
    if ((long long)d[i].size() >= n - 1) {
      sort(d[i].begin(), d[i].end());
      if ((long long)d[i].size() == n - 1) {
        while (d[i][0]--) ans *= i;
      } else {
        while (d[i][1]--) ans *= i;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
