#include <bits/stdc++.h>
using namespace std;
long long int inf = (1e18 + 2);
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
vector<long long int> getUniqs(vector<long long int> vec) {
  sort((vec).begin(), (vec).end());
  auto itr = unique((vec).begin(), (vec).end());
  vec.resize(distance(vec.begin(), itr));
  return vec;
}
vector<long long int> arr[200001];
bool prime[200001];
int main() {
  long long int n;
  cin >> n;
  long long int val;
  long long int ctr = 0;
  long long int a[n + 1];
  vector<long long int> primes;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= 200000; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= 200000; i += p) prime[i] = false;
    }
  }
  for (long long int i = 2; i < 200001; i++)
    if (prime[i]) primes.push_back(i);
  long long int ans = 1;
  for (long long int q = 0; q < n; q++) {
    val = a[q];
    ctr = 0;
    while (val % 2 == 0) {
      ctr++;
      val /= 2;
    }
    if (ctr != 0) arr[2].push_back(ctr);
    ctr = 0;
    for (long long int i = 3; i * i <= val; i += 2) {
      ctr = 0;
      while (val % i == 0) {
        ctr++;
        val /= i;
      }
      if (ctr != 0) arr[i].push_back(ctr);
    }
    if (val > 2) arr[val].push_back(1);
  }
  long long int pr, value;
  for (long long int i = 0; i < (long long int)(primes.size()); i++) {
    pr = primes[i];
    if ((long long int)(arr[pr].size()) <= (n - 2)) continue;
    sort((arr[pr]).rbegin(), (arr[pr]).rend());
    if ((long long int)(arr[pr].size()) == (n - 1)) {
      value = (long long int)pow(pr, arr[pr].back());
      ans *= value;
    } else {
      arr[pr].pop_back();
      value = (long long int)pow(pr, arr[pr].back());
      ans *= value;
    }
  }
  cout << ans << endl;
  return 0;
}
