#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
map<long long, long long> pnums;
map<long long, long long> primeFactors(long long n) {
  map<long long, long long> temp;
  if (n % 2 == 0) {
    pnums[2]++;
  }
  while (n % 2 == 0) {
    n = n / 2;
    temp[2]++;
  }
  for (long long i = 3; i <= sqrt(n); i = i + 2) {
    if (n % i == 0) {
      pnums[i]++;
    }
    while (n % i == 0) {
      n = n / i;
      temp[i]++;
    }
  }
  if (n > 2) {
    pnums[n]++;
    temp[n]++;
  }
  return temp;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  map<long long, pair<long long, long long>> mintwo;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    map<long long, long long> temp = primeFactors(a[i]);
  }
  for (auto it : pnums) {
    mintwo[it.first] = {mod, mod};
  }
  pnums.clear();
  for (long long i = 0; i < n; i++) {
    map<long long, long long> temp = primeFactors(a[i]);
    for (auto it : temp) {
      if (it.second < mintwo[it.first].first) {
        mintwo[it.first].second = mintwo[it.first].first;
        mintwo[it.first].first = it.second;
      } else if (it.second < mintwo[it.first].second) {
        mintwo[it.first].second = it.second;
      }
    }
  }
  long long ans = 1LL;
  for (auto it : pnums) {
    if (it.second == n) {
      long long lim = mintwo[it.first].second < mod ? mintwo[it.first].second
                                                    : mintwo[it.first].first;
      for (long long i = 0; i < lim; i++) {
        ans *= it.first;
      }
    } else if (it.second == n - 1) {
      for (long long i = 0; i < mintwo[it.first].first; i++) {
        ans *= it.first;
      }
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
