#include <bits/stdc++.h>
using namespace std;
long long poj[200003], arr[100003];
vector<long long> veki;
long long gcd(long long first, long long second) {
  long long t = second;
  while (second) {
    second = first % second;
    first = t;
    t = second;
  }
  return first;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    for (int j = 2ll; j * j <= arr[i]; j++) {
      if (arr[i] % j == 0) {
        long long first = 1ll;
        while (arr[i] % j == 0) {
          arr[i] /= j;
          first *= j;
          poj[first]++;
        }
      }
    }
    poj[arr[i]]++;
  }
  for (long long i = 2ll; i <= 200000; i++) {
    if (poj[i] >= n - 1) veki.push_back(i);
  }
  long long sol = 1ll;
  for (int i = 0; i < veki.size(); i++) {
    sol = (sol * veki[i]) / gcd(sol, veki[i]);
  }
  cout << sol;
  return 0;
}
