#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, vector<int>> pr;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (int j = 2; j * j <= a[i]; ++j) {
      int cnt = 0;
      while (a[i] % j == 0) {
        a[i] /= j;
        ++cnt;
      }
      if (cnt) {
        pr[j].push_back(cnt);
      }
    }
    if (a[i] > 1) {
      pr[a[i]].push_back(1);
    }
  }
  long long res = 1;
  for (auto& [p, v] : pr) {
    sort(v.begin(), v.end());
    int x = 0;
    if (v.size() == n) {
      x = v[1];
    } else if (v.size() == n - 1) {
      x = v[0];
    }
    while (x--) {
      res *= p;
    }
  }
  cout << res;
  return 0;
}
