#include <bits/stdc++.h>
using namespace std;
vector<long long> primes;
void pre() {
  long long i, j;
  long long n = 200005;
  vector<bool> isPrime(n, true);
  for (i = (2); i < (n); i++) {
    if (isPrime[i]) {
      vector<long long> v;
      primes.push_back(i);
      for (j = 2 * i; j < n; j += i) {
        isPrime[j] = false;
      }
    }
  }
}
long long powerr(long long base, long long p) {
  if (p == 0) return 1;
  if (p == 1) return base;
  long long p2 = (p / 2);
  long long pow2 = powerr(base, p2);
  long long ans = pow2 * pow2;
  if (p % 2 == 1) {
    ans *= base;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long i, j, k;
  pre();
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (i = (0); i < (n); i++) {
    cin >> v[i];
  }
  long long ans = 1;
  for (auto it : primes) {
    vector<long long> counts;
    long long zeroc = 0;
    for (i = (0); i < (n); i++) {
      long long count = 0;
      long long tmp = v[i];
      while (tmp % it == 0) {
        tmp /= it;
        count++;
      }
      counts.push_back(count);
      if (count == 0) zeroc++;
      if (zeroc >= 2) break;
    }
    sort((counts).begin(), (counts).end());
    ans = ans * powerr(it, counts[1]);
  }
  cout << ans << '\n';
  return 0;
}
