#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007LL;
vector<pair<long long, long long> > P[200005];
inline long long pow(long long a, long long p) {
  if (p == 0) return 1;
  if (p & 1)
    return ((pow(a, p - 1) * a));
  else {
    long long x = pow(a, p >> 1);
    return (x * x);
  }
}
unordered_map<long long, pair<long long, long long> > m;
unordered_map<long long, long long> ctr;
unordered_set<long long> primes;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 2; i <= 200005; i++) {
    if (P[i].empty()) {
      for (long long j = i; j <= 200001; j += i) {
        long long x = j;
        long long cnt = 0;
        while (x % i == 0) {
          cnt++;
          x /= i;
        }
        P[j].push_back(pair<long long, long long>(i, cnt));
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (pair<long long, long long> b : P[x]) {
      pair<long long, long long> p = b;
      primes.insert(b.first);
      ctr[b.first]++;
      pair<long long, long long> ans;
      if (m.find(b.first) == m.end()) {
        ans = pair<long long, long long>(p.second, 10000000);
        m[b.first] = ans;
      } else {
        pair<long long, long long> x = m[p.first];
        pair<long long, long long> ans;
        ans.first = min(x.first, p.second);
        ans.second = min(x.second, max(p.second, x.first));
        m[b.first] = ans;
      }
    }
  }
  long long ans = 1;
  for (long long p : primes) {
    if (ctr[p] == n) {
      ans *= pow(p, m[p].second);
    } else if (ctr[p] == n - 1) {
      ans *= pow(p, m[p].first);
    }
  }
  cout << ans;
}
