#include <bits/stdc++.h>
using namespace std;
typedef struct st {
  long long index, value;
} node;
map<long long, vector<node> > m;
void primeFactors(long long ind, long long n) {
  node x;
  x.index = ind;
  long long num = 0, i;
  while (n % 2 == 0) {
    n = n / 2;
    num++;
  }
  if (num > 0) {
    x.value = num;
    m[2].push_back(x);
  }
  for (i = 3; i <= sqrt(n); i = i + 2) {
    num = 0;
    while (n % i == 0) {
      n = n / i;
      num++;
    }
    if (num > 0) {
      x.value = num;
      m[i].push_back(x);
    }
  }
  if (n > 2) {
    x.value = 1;
    m[n].push_back(x);
  }
}
bool cmp(node x, node y) { return x.value < y.value; }
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < (long long)n; ++i) {
    cin >> a[i];
    primeFactors(i, a[i]);
  }
  long long ans = 1;
  vector<node> nod;
  for (auto it : m) {
    nod = it.second;
    if (nod.size() >= n - 1) {
      if (nod.size() == n - 1) {
        node x;
        x.index = n;
        x.value = 0;
        nod.push_back(x);
      }
      sort(nod.begin(), nod.end(), cmp);
      ans = ans * pow(it.first, nod[1].value);
    }
  }
  cout << ans << endl;
  return 0;
}
