#include <bits/stdc++.h>
using namespace std;
long long lim = 200000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i;
  cin >> n;
  long long A[n];
  for (auto i = 0; i < n; i++) cin >> A[i];
  bool second[lim + 1];
  memset(second, true, sizeof(second));
  second[0] = second[1] = false;
  vector<long long> P;
  for (auto i = 2; i < lim + 1; i++) {
    long long j = 2;
    if (second[i]) P.push_back(i);
    while (i * j <= lim) {
      second[i * j] = false;
      j++;
    }
  }
  long long ans = 1;
  for (auto it = P.begin(); it != P.end(); it++) {
    long long pr = *it;
    long long count = 0;
    long long s1 = -1;
    long long s2 = -1;
    bool flag = false;
    for (auto i = 0; i < n; i++) {
      long long e = 0;
      long long num = A[i];
      while (num % pr == 0) {
        e++;
        num = num / pr;
      }
      if (s1 == -1)
        s1 = e;
      else if (s2 == -1) {
        if (e >= s1)
          s2 = e;
        else {
          s2 = s1;
          s1 = e;
        }
      } else {
        if (e <= s1) {
          s2 = s1;
          s1 = e;
        } else if (e > s1 && e <= s2) {
          s2 = e;
        }
      }
      if (e == 0) count++;
      if (count >= 2) {
        flag = true;
        break;
      }
    }
    if (!flag && s1 != -1 && s2 != -1) {
      ans *= pow(pr, s2);
    }
  }
  cout << ans << '\n';
}
