#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int Nmax = 2.1e5;
bitset<Nmax> prime;
vector<int> primes;
void calc_primes(int n) {
  for (int i = 2; i < n; i++) {
    prime[i] = 1;
  }
  for (int p = 2; p < n; p++) {
    if (prime[p]) {
      primes.push_back(p);
      for (int j = 2 * p; j < Nmax; j += p) {
        prime[j] = 0;
      }
    }
  }
}
int main(void) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  calc_primes(Nmax);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  set<int> pp;
  for (int i = 0; i < (int)(2); i++) {
    int x = a[i];
    for (auto p : primes) {
      if (x % p == 0) {
        pp.insert(p);
        while (x % p == 0) {
          x /= p;
        }
      }
      if (x > 1 && 1ll * p * p > x) {
        pp.insert(x);
        break;
      }
      if (x == 1) {
        break;
      }
    }
  }
  long long ans = 1;
  for (auto p : pp) {
    int pw0 = INF, pw1 = INF;
    for (auto &x : a) {
      int pw = 0;
      while (x > 1 && x % p == 0) {
        x /= p;
        pw++;
      }
      if (pw <= pw0) {
        pw1 = pw0;
        pw0 = pw;
      } else if (pw <= pw1) {
        pw1 = pw;
      }
    }
    int res = (pw1 == INF ? pw0 : pw1);
    for (int i = 0; i < (int)(res); i++) {
      ans *= p;
    }
  }
  cout << ans << '\n';
  return 0;
}
