#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int MAX_VAL = 200000;
vi primes;
int spf[MAX_VAL + 1];
map<int, vector<int>> mp;
void sieve() {
  for (int i = (2); i <= (MAX_VAL); i++) {
    if (spf[i] == 0) {
      primes.push_back(i);
      spf[i] = i;
      for (ll j = (ll)i * i; j <= MAX_VAL; j += i)
        if (spf[j] == 0) spf[j] = i;
    }
  }
}
void update(int x) {
  while (x > 1) {
    int p = spf[x];
    int c = 0;
    while (x % p == 0) x /= p, c++;
    mp[p].push_back(c);
  }
}
const int mod = 1000000007;
int modpow(int a, int n) {
  int v = 1;
  for (int i = 31; i >= 0; i--) {
    (v *= v) %= mod;
    if (n & (1 << i)) (v *= a) %= mod;
  }
  return v;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  sieve();
  ;
  int n;
  cin >> n;
  int a;
  for (int i = 0; i < (n); i++) {
    cin >> a;
    update(a);
  }
  ll ans = 1;
  for (auto it = (mp).begin(); it != (mp).end(); it++) {
    sort((it->second).begin(), (it->second).end());
    if ((int)(it->second).size() == n)
      ans *= modpow(it->first, it->second[1]);
    else if ((int)(it->second).size() == n - 1)
      ans *= modpow(it->first, it->second[0]);
  }
  cout << ans << '\n';
  return 0;
}
