#include <bits/stdc++.h>
using namespace std;
long long _sieve_size;
bitset<10000010> bs;
vector<long long> primes;
void sieve(long long upperbound) {
  _sieve_size = upperbound + 1;
  bs.set();
  bs[0] = bs[1] = 0;
  for (long long i = 2; i <= _sieve_size; i++)
    if (bs[i]) {
      for (long long j = i * i; j <= _sieve_size; j += i) bs[j] = 0;
      primes.push_back(i);
    }
}
map<long long, long long> getPrimeFact(long long n) {
  long long i = 0, pf = primes[0];
  map<long long, long long> ans;
  while (pf * pf <= n) {
    while (n % pf == 0) {
      n /= pf;
      ans[pf]++;
    }
    pf = primes[++i];
  }
  if (n != 1) ans[n]++;
  return ans;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long poww(long long a, long long x) {
  if (x == 0) return 1LL;
  long long res = poww(a, x / 2);
  if (x % 2) {
    return a * res * res;
  } else {
    return res * res;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  sieve(200100);
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  if (n == 2) {
    printf("%lld\n", lcm(a[0], a[1]));
    return 0;
  }
  vector<map<long long, long long>> primeFacts(n);
  map<long long, pair<long long, long long>> doisMenores;
  map<long long, long long> apareceu;
  for (int i = 0; i < int(primes.size()); i++) {
    doisMenores[primes[i]] =
        make_pair(0x3f3f3f3f3f3f3f3fLL, 0x3f3f3f3f3f3f3f3fLL);
  }
  for (int i = 0; i < n; i++) {
    primeFacts[i] = getPrimeFact(a[i]);
    for (auto par : primeFacts[i]) {
      long long num = par.first;
      long long pot = par.second;
      apareceu[num]++;
      if (doisMenores[num].first >= pot) {
        doisMenores[num].second = doisMenores[num].first;
        doisMenores[num].first = pot;
      } else if (doisMenores[num].second >= pot) {
        doisMenores[num].second = pot;
      }
    }
  }
  long long ans = 1;
  for (long long p : primes) {
    if (apareceu[p] == n - 1) {
      ans *= poww(p, doisMenores[p].first);
    } else if (apareceu[p] == n) {
      ans *= poww(p, doisMenores[p].second);
    }
  }
  cout << ans << endl;
  return 0;
}
