#include <bits/stdc++.h>
int read() {
  int x = 0, pos = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') pos = 0;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  return pos ? x : -x;
}
using namespace std;
int n;
int t[2000001], tx[2000001], a[2000001];
int minfactor[1000001], prime[1000001], q[1000001], phi[1000001], isp[1000001];
void getp() {
  n = 300000;
  int top = 0;
  q[1] = 1;
  for (int i = 2; i <= n; i++) {
    minfactor[i] = i;
  }
  for (int i = 2; i <= n; i++) {
    if (minfactor[i] == i) {
      prime[++top] = i;
      isp[i] = 1;
    }
    for (int j = 1; j <= top && prime[j] * i <= n && prime[j] <= minfactor[i];
         j++) {
      minfactor[i * prime[j]] = prime[j];
    }
  }
}
int bg[1100001], tp = 0;
int cn[1000001];
int main() {
  getp();
  n = read();
  if (n == 1) {
    printf("%d", read());
    return 0;
  }
  for (int i = 1; i <= 200000; i++) {
    t[i] = tx[i] = 1e9;
  }
  int now = sqrt(200000);
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    int nn = a[i];
    for (int i = 2; i <= now; ++i) {
      if (!isp[i]) {
        continue;
      }
      int nt = 0;
      while (nn % i == 0) {
        nt++;
        nn /= i;
      }
      if (nt <= t[i])
        tx[i] = t[i], t[i] = nt;
      else if (nt < tx[i])
        tx[i] = nt;
    }
    if (nn > 1) {
      bg[++tp] = nn;
    }
  }
  for (int i = 1; i <= tp; i++) {
    cn[bg[i]]++;
  }
  long long ans = 1;
  for (int i = now + 1; i <= 200000; i++) {
    if (!isp[i])
      continue;
    else if (cn[i] >= n - 1)
      tx[i] = 1;
  }
  for (int i = 1; i <= 200000; i++) {
    if (isp[i]) {
      if (tx[i] == 1e9) continue;
      for (int j = 1; j <= tx[i]; j++) {
        ans = 1ll * ans * i;
      }
    }
  }
  printf("%lld", ans);
  return 0;
}
