#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int il[N];
bool prime[N];
vector<int> P[N];
void sieve() {
  for (int i = 0; i < N - 3; i++) prime[i] = true;
  for (int i = 2; i <= N - 3; i++) {
    if (!prime[i]) continue;
    for (int j = i; j <= N - 3; j += i) {
      if (j > i) prime[j] = false;
      int rs = 1;
      int tmp = j;
      if (il[j] == 0) continue;
      while (tmp % i == 0) {
        rs *= i;
        tmp /= i;
      }
      int z = il[j];
      while (z--) P[i].push_back(rs);
    }
  }
}
int main() {
  for (int i = 0; i < N - 3; i++) il[i] = 0;
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    il[a]++;
  }
  sieve();
  long long res = 1;
  for (int i = 2; i <= N - 2; i++) {
    if (P[i].size() < n - 1) continue;
    if (P[i].size() == n - 1) P[i].push_back(1);
    nth_element(P[i].begin(), P[i].begin() + 1, P[i].end());
    res *= P[i][1];
  }
  printf("%lld\n", res);
}
