#include <bits/stdc++.h>
using namespace std;
const int INF = 300000;
const int MAXN = 200000;
const int MXN = 200010;
int n, a[MXN], p[MXN], ptot, minn[MXN], minn2[MXN], num[MXN], pos[MXN];
bool flag[MXN];
void solve() {
  for (int i = 2; i <= MAXN; i++)
    if (!flag[i]) {
      p[++ptot] = i;
      pos[i] = ptot;
      minn[ptot] = minn2[ptot] = INF;
      for (int j = 1; j <= MAXN / i; j++) {
        flag[i * j] = 1;
      }
    }
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    int noww = a[i];
    int tmp = ((int)sqrt(a[i])) + 3;
    for (int j = 1; j <= ptot; j++) {
      if (p[j] > tmp) break;
      int cnt = 0;
      num[j]++;
      while (noww % p[j] == 0) {
        noww = noww / p[j];
        cnt++;
      }
      if (cnt < minn[j]) {
        minn2[j] = minn[j];
        minn[j] = cnt;
      } else if (cnt < minn2[j]) {
        minn2[j] = cnt;
      }
    }
    if (noww > 1) {
      int cnt = 1;
      num[pos[noww]]++;
      if (cnt < minn[pos[noww]]) {
        minn2[pos[noww]] = minn[pos[noww]];
        minn[pos[noww]] = cnt;
      } else if (cnt < minn2[pos[noww]]) {
        minn2[pos[noww]] = cnt;
      }
    }
  }
  for (int i = 1; i <= ptot; i++) {
    if (num[i] == n - 1) {
      minn2[i] = minn[i];
      minn[i] = 0;
    } else if (num[i] < n - 1) {
      minn2[i] = minn[i] = 0;
    }
  }
  long long ans = 1;
  for (int i = 1; i <= ptot; i++) {
    for (int j = 1; j <= minn2[i]; j++) {
      ans *= p[i];
    }
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
