#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  long long ans = power(a, b / 2);
  ans *= ans;
  if (b % 2 == 1) ans *= a;
  return ans;
}
const int maxn = 1e6 + 10;
long long n, a[maxn], prime[12][3], cnt, cnt2, ans = 1;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 2; i <= a[0]; i++) {
    if (a[0] % i == 0) {
      prime[cnt][0] = i;
      while (a[0] % i == 0) {
        prime[cnt][1]++;
        a[0] /= i;
      }
      cnt++;
    }
  }
  for (int i = 0; i < cnt; i++) {
    while (a[1] % prime[i][0] == 0) {
      prime[i][2]++;
      a[1] /= prime[i][0];
    }
  }
  for (int i = 2; i <= a[1]; i++) {
    if (a[1] % i == 0) {
      prime[cnt][0] = i;
      while (a[1] % i == 0) {
        prime[cnt][1]++;
        a[1] /= i;
      }
      cnt++;
    }
  }
  for (int i = 0; i < cnt; i++)
    if (prime[i][1] > prime[i][2]) swap(prime[i][1], prime[i][2]);
  for (int i = 2; i < n; i++) {
    for (int j = 0; j < cnt; j++) {
      cnt2 = 0;
      while (a[i] % prime[j][0] == 0) {
        cnt2++;
        a[i] /= prime[j][0];
      }
      if (cnt2 <= prime[j][1]) {
        prime[j][2] = prime[j][1];
        prime[j][1] = cnt2;
      } else if (cnt2 <= prime[j][2]) {
        prime[j][2] = cnt2;
      }
    }
  }
  for (int i = 0; i < cnt; i++) ans *= power(prime[i][0], prime[i][2]);
  cout << ans;
  return 0;
}
