#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
const long double pi = 3.141592653589793238;
long long MOD = 1000000007;
const long long N = 2e5 + 10;
map<long long, multiset<long long>> m;
long long last[N] = {0}, a[N];
void filler() {
  for (long long i = 2; i < N; i++) {
    if (last[i] == 0)
      for (long long j = i; j < N; j += i) {
        last[j] = i;
      }
  }
  for (long long i = 1; i < N; i++)
    if (last[i] == 0) last[i] = i;
}
long long power(long long a, long long b) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2) {
      x = (x * y);
    }
    y = (y * y);
    b /= 2;
  }
  return x;
}
void solve() {
  filler();
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    long long x = a[i];
    map<long long, long long> cur;
    while (x > 1) {
      cur[last[x]]++;
      x /= last[x];
    }
    for (auto i : cur) m[i.first].insert(i.second);
  }
  long long ans = 1;
  for (auto i : m) {
    if ((long long)i.second.size() < n - 1) continue;
    auto it = i.second.begin();
    long long cnt = *it;
    it = next(it);
    if ((long long)i.second.size() == n) cnt = *it;
    ans *= power(i.first, cnt);
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
