#include <bits/stdc++.h>
using namespace std;
int m1[200010] = {0}, m2[200010] = {0};
map<int, int> pp;
bool d[200010];
int e[100000];
int main() {
  int n;
  cin >> n;
  long long x;
  int p = 2;
  int tt = 0;
  for (int i = 2; i <= 200005; i++) {
    m1[i] = m2[i] = 1000000000;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (int uu = 2; uu * uu <= x; uu++)
      if (x % uu == 0) {
        int k = 0;
        while (x % uu == 0) {
          x = x / uu;
          k++;
        }
        if (k != 0) {
          if (k < m1[uu]) {
            m2[uu] = m1[uu];
            m1[uu] = k;
          } else if (k < m2[uu]) {
            m2[uu] = k;
          }
          pp[uu]++;
        }
      }
    if (x > 1) {
      pp[x]++;
      if (1 < m1[x]) {
        m2[x] = m1[x];
        m1[x] = 1;
      } else if (1 < m2[x]) {
        m2[x] = 1;
      }
    }
  }
  long long sum = 1;
  int uu = 1;
  while (uu < 200000) {
    uu++;
    if (pp[uu] < n - 1) continue;
    if (pp[uu] == n - 1) {
      sum = sum * pow(uu, m1[uu]);
    } else
      sum = sum * pow(uu, m2[uu]);
  }
  cout << sum << endl;
}
