#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
long long ksm(long long a, long long b) {
  if (b < 0) return 0;
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
int a[maxn];
int n, m;
vector<int> v[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  map<int, int> mp;
  map<int, int> pos;
  int t = 1;
  for (int i = 0; i < n; i++) {
    int kk = sqrt(a[i]), k = a[i];
    for (int i = 2; i <= kk; i++) {
      if (k % i == 0) {
        int ci = 1;
        k /= i;
        while (k % i == 0) {
          ci++;
          k /= i;
        }
        if (mp[i] == 0) {
          pos[t] = i;
          mp[i] = t++;
        }
        v[mp[i]].push_back(ci);
      }
    }
    if (k != 1) {
      if (mp[k] == 0) {
        pos[t] = k;
        mp[k] = t++;
      }
      int ci = 1;
      v[mp[k]].push_back(ci);
    }
  }
  long long ans = (long long)1;
  for (int i = 1; i < t; i++) {
    int z = pos[i], l = v[i].size();
    if (n - l >= 2) {
      continue;
    }
    sort(v[i].begin(), v[i].end());
    if ((n - l) == 1) {
      ans *= (long long)(ksm((long long)z, (long long)v[i][0]));
    } else if ((n - l) == 0) {
      ans *= (long long)(ksm((long long)z, (long long)v[i][1]));
    }
  }
  printf("%lld\n", ans);
}
