#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const double EPS = 1e-9;
const int N = 5e5 + 9;
int n, x;
map<int, vector<int>> cnt;
void fac(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i) continue;
    int c = 0;
    while (x % i == 0) x /= i, c++;
    cnt[i].push_back(c);
  }
  if (x > 1) cnt[x].push_back(1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    fac(x);
  }
  long long ans = 1;
  for (auto p : cnt) {
    if ((int)p.second.size() <= n - 2) continue;
    sort(cnt[p.first].begin(), cnt[p.first].end());
    if ((int)p.second.size() == n)
      while (cnt[p.first][1]--) ans *= (long long)p.first;
    else
      while (cnt[p.first][0]--) ans *= (long long)p.first;
  }
  cout << ans << endl;
  return 0;
}
