#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int n, i, x, j;
  vector<int> resh(2e5 + 1), kol(2e5 + 1);
  vector<pair<int, int> > mn;
  mn.assign(2e5 + 1, {INT_MAX, INT_MAX});
  for (x = 2; x <= 2e5; ++x) {
    if (resh[x]) continue;
    for (i = x; i <= 2e5; i += x)
      if (!resh[i]) {
        resh[i] = x;
      }
  }
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> x;
    vector<pair<int, int> > base;
    if (x == 1) {
      continue;
    }
    base.push_back({resh[x], 1});
    x /= resh[x];
    while (x > 1) {
      if (resh[x] == base.back().first) {
        ++base.back().second;
      } else {
        base.push_back({resh[x], 1});
      }
      x /= resh[x];
    }
    for (j = 0; j < base.size(); ++j) {
      int ind = base[j].first;
      ++kol[ind];
      if (base[j].second < mn[ind].second) {
        mn[ind].second = base[j].second;
        if (mn[ind].second < mn[ind].first) {
          swap(mn[ind].second, mn[ind].first);
        }
      }
    }
  }
  long long res = 1;
  for (i = 2; i <= 2e5; ++i)
    if (kol[i] == n - 1) {
      res *= pow(i, mn[i].first);
    } else if (kol[i] == n) {
      res *= pow(i, mn[i].second);
    }
  cout << res;
  return 0;
}
