#include <bits/stdc++.h>
using namespace std;
const int MAX = 200010;
vector<pair<int, int> > factor[MAX];
bool isComp[MAX];
void generatePPF(int N) {
  int cnt, tmp, x;
  for (int i = 2; i <= N; i++) {
    if (!isComp[i]) {
      for (int j = i; j <= N; j += i) {
        if (i != j) isComp[j] = true;
        tmp = j, cnt = 0;
        while (true) {
          x = tmp / i;
          if (x * i != tmp) break;
          tmp = x;
          cnt++;
        }
        factor[j].push_back({i, cnt});
      }
    }
  }
}
vector<int> L[MAX];
int a[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  generatePPF(200005);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (pair<int, int> e : factor[a[i]]) {
      L[e.first].push_back(e.second);
    }
  }
  long long ans = 1;
  for (int e = 1; e <= 2e5; e++) {
    if (isComp[e]) continue;
    sort(L[e].begin(), L[e].end());
    if ((int)L[e].size() <= (n - 2)) {
    } else if ((int)L[e].size() <= (n - 1)) {
      for (int i = 1; i <= L[e][0]; i++) ans *= e;
    } else {
      for (int i = 1; i <= L[e][1]; i++) ans *= e;
    }
  }
  cout << ans << endl;
  return 0;
}
