#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  set<long long> sll;
  long long n, i, j, val, res = 1, freq, flag, x;
  for (i = 2; i < 200002; i++) {
    sll.insert(i);
  }
  for (auto it : sll) {
    for (j = 2; j <= 200002 / it; j++) {
      if (sll.find(it * j) != sll.end()) {
        val = it * j;
        sll.erase(val);
      }
    }
  }
  cin >> n;
  long long A[n], fmi = 30, smi = 30;
  for (i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (auto it : sll) {
    fmi = 30;
    smi = 30;
    for (i = 0; i < n; i++) {
      freq = 1;
      while (A[i] % int(pow(it, freq)) == 0) {
        freq++;
      }
      freq--;
      if (freq <= fmi) {
        smi = fmi;
        fmi = freq;
      } else if (freq < smi) {
        smi = freq;
      }
      if (smi == 0) {
        break;
      }
    }
    if (smi != 0) {
      if (smi == 30) {
        if (fmi != 30) {
          res *= pow(it, fmi);
        }
      } else {
        res *= pow(it, smi);
      }
    }
  }
  cout << res << "\n";
  return 0;
}
