#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<long long, long long>>> powers(200005);
void factorize(long long n) {
  for (long long i = 2; i < n; i++) {
    if (powers[i].empty()) {
      for (long long j = i; j < n; j += i) {
        long long q = j;
        long long power = 0;
        while (q % i == 0) {
          q /= i;
          power++;
        }
        powers[j].push_back(make_pair(i, power));
      }
    }
  }
}
int main() {
  long long n;
  cin >> n;
  vector<long long> nums;
  long long m = -1;
  for (int i = 0; i < n; i++) {
    long long k;
    cin >> k;
    m = max(m, k);
    nums.push_back(k);
  }
  factorize(m + 1);
  unordered_map<long long, vector<long long>> primesUsed;
  long long maxPrimeFacs = 0;
  for (auto num : nums) {
    for (auto p : powers[num]) {
      primesUsed[p.first].push_back(p.second);
      long long t = primesUsed[p.first].size();
      if (t > maxPrimeFacs) maxPrimeFacs = t;
    }
  }
  long long ans = 1;
  for (auto i = primesUsed.begin(); i != primesUsed.end(); i++) {
    long long prime = i->first;
    auto vec = i->second;
    long long t = vec.size();
    if (n - t >= 2) {
    } else {
      sort(vec.begin(), vec.end());
      if (n - t == 1)
        ans *= pow(prime, vec[0]);
      else
        ans *= pow(prime, vec[1]);
    }
  }
  cout << ans << endl;
}
