#include <bits/stdc++.h>
using namespace std;
vector<long long> primes;
bitset<1000005> bs;
long long N, A[200005];
vector<int> pfact[200005];
int zeros[200005];
void sieve() {
  bs.set();
  bs[0] = bs[1] = 0;
  for (long long i = 2; i <= 200000; ++i) {
    if (bs[i]) {
      primes.push_back(i);
      for (long long j = i * i; j <= 200000; j += i) {
        bs[j] = 0;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  sieve();
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
    for (auto it : primes) {
      if (it * it > A[i]) break;
      int cnt = 0;
      while (A[i] % it == 0) {
        cnt++;
        A[i] /= it;
      }
      if (cnt) {
        pfact[it].push_back(cnt);
      }
    }
    if (A[i] != 1) {
      pfact[A[i]].push_back(1);
    }
  }
  for (int i = 1; i <= 200000; ++i) sort(pfact[i].begin(), pfact[i].end());
  long long ans = 1;
  for (auto it : primes) {
    int x;
    if (pfact[it].size() == N)
      x = 1;
    else if (pfact[it].size() == N - 1)
      x = 0;
    else
      continue;
    x = pfact[it][x];
    for (int i = 1; i <= x; ++i) {
      ans *= it;
    }
  }
  cout << ans << '\n';
}
