#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
long long cnt[200010], sec[200010], fir[200010], n, a[200010], ans = 1, xsc = 1;
inline long long qpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res *= x;
    x *= x;
    k >>= 1;
  }
  return res;
}
inline void work(long long x) {
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      long long tmp = 0;
      cnt[i]++;
      while (x % i == 0) x /= i, tmp++;
      if (tmp <= fir[i])
        sec[i] = fir[i], fir[i] = tmp;
      else if (tmp <= sec[i])
        sec[i] = tmp;
    }
  }
  if (x != 1) {
    cnt[x]++;
    if (1 <= fir[x])
      sec[x] = fir[x], fir[x] = 1;
    else if (1 <= sec[x])
      sec[x] = 1;
  }
  return;
}
signed main() {
  n = read();
  for (long long i = 1; i <= 200000; i++) fir[i] = sec[i] = 998244353;
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= n; i++) work(a[i]);
  for (long long i = 1; i <= 200000; i++) {
    if (cnt[i] == n - 1) {
      if (0 <= fir[i])
        sec[i] = fir[i], fir[i] = 0;
      else if (0 <= sec[i])
        sec[i] = 0;
    }
    if (cnt[i] >= n - 1) {
      if (sec[i] == 998244353)
        ans *= qpow(i, fir[i]);
      else
        ans *= qpow(i, sec[i]);
    }
  }
  cout << ans;
  return 0;
}
