#include <bits/stdc++.h>
using namespace std;
int get_min(int k, vector<int> &arr) {
  int min1 = 1e6, min2 = 1e6;
  for (int i : arr) {
    if (i <= min1) {
      min2 = min1;
      min1 = i;
    } else if (i < min2)
      min2 = i;
  }
  if (k == 1) return min1;
  return min2;
}
long long my_pow(int a, int p) {
  if (p == 0)
    return 1;
  else if (p == 1)
    return a;
  else if (p % 2 == 0) {
    long long half = my_pow(a, p / 2);
    return half * half;
  } else {
    long long half = my_pow(a, p / 2);
    return half * half * a;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  vector<int> primes = {2};
  for (int i = 3; i * i <= 2e5; i += 2) {
    bool prime = true;
    for (int p : primes)
      if (i % p == 0) prime = false;
    if (prime) primes.emplace_back(i);
  }
  map<int, vector<int>> cnt;
  for (int num : a) {
    for (int i = 0; i < primes.size() && primes[i] * primes[i] <= num; ++i) {
      int cur_cnt = 0;
      while (num % primes[i] == 0) {
        num /= primes[i];
        ++cur_cnt;
      }
      if (cur_cnt > 0) cnt[primes[i]].emplace_back(cur_cnt);
    }
    if (num != 1) cnt[num].emplace_back(1);
  }
  long long ans = 1;
  for (auto [p, degs] : cnt) {
    if (degs.size() == n - 1)
      ans *= my_pow(p, get_min(1, degs));
    else if (degs.size() == n)
      ans *= my_pow(p, get_min(2, degs));
  }
  cout << ans << endl;
  return 0;
}
