#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int>> ma;
map<int, int> co;
int n;
int nmax = 2 * 1e5 + 10;
vector<bool> prime(nmax + 1, true);
vector<int> p;
void seive() {
  for (int i = 2; i * i <= nmax; i++) {
    if (prime[i]) {
      for (int j = i * i; j <= nmax; j += i) prime[j] = false;
    }
  }
  for (int i = 2; i < nmax; i++) {
    if (prime[i]) {
      p.push_back(i);
    }
  }
}
void update(int p, int c) {
  if (ma.count(p)) {
    if (ma[p].second == -1) {
      ma[p].second = c;
      if (c <= ma[p].first) {
        swap(ma[p].first, ma[p].second);
      }
    } else {
      if (c <= ma[p].first) {
        swap(ma[p].first, ma[p].second);
        ma[p].first = c;
      } else if (c > ma[p].first && c < ma[p].second)
        ma[p].second = c;
    }
  } else {
    pair<int, int> pa = {c, -1};
    ma[p] = pa;
  }
  co[p]++;
}
void primefact(int ind, int val) {
  map<int, int> time;
  int c = 0;
  while (val % 2 == 0) {
    c++;
    val = val / 2;
    ;
  }
  if (c) time[2] = c;
  for (int i = 3; i <= sqrt(val); i = i + 2) {
    c = 0;
    while (val % i == 0) {
      c++;
      val = val / i;
    }
    if (c) time[i] = c;
  }
  if (val > 1) {
    if (time.count(val))
      time[val]++;
    else
      time[val] = 1;
  }
  for (auto i : time) update(i.first, i.second);
}
long long int pow(long long int a, long long int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = res * a;
    b >>= 1;
    a = a * a;
  }
  return res;
}
int main() {
  cin >> n;
  seive();
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    primefact(i, x);
  }
  long long int ans = 1;
  for (auto i : ma) {
    if (co[i.first] == n)
      ans *= pow(i.first, i.second.second);
    else if (co[i.first] == n - 1)
      ans *= pow(i.first, i.second.first);
  }
  cout << ans << endl;
  return 0;
}
