#include <bits/stdc++.h>
using namespace std;
int pr[2 * 100 * 1000 + 10];
int a[2 * 100 * 1000 + 10];
int main() {
  int max_n = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > max_n) max_n = a[i];
  }
  for (int i = 0; i <= max_n; i++) pr[i] = 1;
  for (int i = 2; i <= max_n; i++)
    if (pr[i]) {
      int k = 2;
      while (i * k <= max_n) {
        pr[i * k] = 0;
        k++;
      }
    }
  long long ans = 1;
  for (long long i = 2; i <= max_n; i++) {
    if (!pr[i]) continue;
    int bad_index = -1;
    long long cur = i;
    while (cur <= max_n) {
      int cnt = 0;
      int new_bad = -1;
      for (int j = 0; j < n; j++)
        if (j != bad_index && a[j] % cur) {
          cnt++;
          new_bad = j;
          if (cnt > 1) break;
        }
      if (cnt > 1) break;
      if (bad_index != -1 && new_bad != -1) break;
      if (bad_index == -1) bad_index = new_bad;
      ans *= i;
      cur *= i;
    }
  }
  cout << ans << endl;
  return 0;
}
