#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int maxm = 3e6 + 5;
vector<int> v[maxn];
int prime[maxn];
bool vis[maxn];
int tol;
void get() {
  tol = 0;
  memset(vis, true, sizeof(vis));
  vis[0] = vis[1] = false;
  for (int i = 2; i < maxn; ++i) {
    if (vis[i]) prime[tol++] = i;
    for (int j = 0; j < tol && prime[j] * i < maxn; ++j) {
      vis[i * prime[j]] = false;
      if (i % prime[j] == 0) break;
    }
  }
}
long long fpow(long long a, long long b) {
  long long ans = 1ll;
  while (b) {
    if (b & 1) ans *= a;
    a *= a;
    b >>= 1;
  }
  return ans;
}
int main() {
  int n, x;
  get();
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    for (int j = 0; j < tol && prime[j] * 1ll * prime[j] <= x; ++j) {
      int cnt = 0;
      while (x % prime[j] == 0) cnt += 1, x /= prime[j];
      if (cnt) v[prime[j]].push_back(cnt);
    }
    if (x > 1) v[x].push_back(1);
  }
  long long ans = 1ll;
  for (int i = 2; i < maxn; ++i) {
    int m = (int)v[i].size();
    if (m < n - 1) continue;
    sort(v[i].begin(), v[i].end());
    if (m == n - 1)
      ans *= fpow(i * 1ll, v[i][0] * 1ll);
    else
      ans *= fpow(i * 1ll, v[i][1] * 1ll);
  }
  printf("%lld\n", ans);
  return 0;
}
