#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  unordered_map<int, int> cnt;
  vector<vector<int>> xx(200002);
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    int x = a[i];
    xx[1].push_back(1);
    for (int j = 2; j <= sqrt(x); j++) {
      int ct = 0;
      while (x % j == 0) {
        x /= j;
        ct++;
      }
      if (ct != 0) {
        cnt[j]++;
        maxi = max(maxi, j);
        if (xx[j].size() == 0) {
          xx[j].push_back(ct);
        } else if (xx[j].size() == 1) {
          xx[j].push_back(ct);
          if (xx[j][0] > xx[j][1]) swap(xx[j][0], xx[j][1]);
        } else if (xx[j].size() == 2) {
          if (ct < xx[j][1]) {
            if (ct < xx[j][0]) {
              xx[j][1] = xx[j][0];
              xx[j][0] = ct;
            } else
              xx[j][1] = ct;
          }
        }
      }
    }
    if (x >= 2) {
      cnt[x]++;
      maxi = max(maxi, x);
      if (xx[x].size() == 0) {
        xx[x].push_back(1);
      } else if (xx[x].size() == 1) {
        xx[x].push_back(1);
        if (xx[x][0] > xx[x][1]) swap(xx[x][0], xx[x][1]);
      } else if (xx[x].size() == 2) {
        if (1 < xx[x][1]) {
          if (1 < xx[x][0]) {
            xx[x][1] = xx[x][0];
            xx[x][0] = 1;
          } else
            xx[x][1] = 1;
        }
      }
    }
  }
  unordered_map<int, int>::iterator it;
  long long ans = 1;
  for (it = cnt.begin(); it != cnt.end(); it++) {
    if (it->second < n - 1) continue;
    if (it->second == n - 1) {
      ans *= (long long)pow(it->first, xx[it->first][0]);
    } else {
      ans *= (long long)pow(it->first, xx[it->first][1]);
    }
  }
  cout << ans << endl;
}
