#include <bits/stdc++.h>
using namespace std;
const long long mx = 2e5;
long long pow(long long a, long long b) {
  if (b == 0) {
    return 1LL;
  }
  long long ans = pow(a, b / 2);
  ans = ans * ans;
  if (b % 2 == 1) {
    ans *= a;
  }
  return ans;
}
int main() {
  vector<int> sieve(mx + 1, -1);
  vector<int> primes;
  for (long long q = 2; q <= mx; q++) {
    for (long long w = 1; q * w <= mx; w++) {
      if (sieve[q * w] == -1) {
        if (w == 1) {
          primes.push_back(q);
        }
        sieve[q * w] = q;
      }
    }
  }
  int n;
  cin >> n;
  vector<int> nums(n);
  for (int q = 0; q < n; q++) {
    cin >> nums[q];
  }
  long long ans = 1;
  for (int f : primes) {
    int lo = INT_MAX, lo1 = INT_MAX;
    for (int q = 0; q < n; q++) {
      int ct = 0;
      int cpy = nums[q];
      while (cpy % f == 0) {
        ct++;
        cpy /= f;
      }
      if (ct <= lo) {
        lo1 = lo;
        lo = ct;
      } else if (ct <= lo1) {
        lo1 = ct;
      }
      if (lo1 == 0) {
        break;
      }
    }
    ans *= pow(f, lo1);
  }
  cout << ans << "\n";
  return 0;
}
