#include <bits/stdc++.h>
using namespace std;
const int MAX = 200020;
vector<int> p;
void init() {
  vector<bool> is_prime(500, true);
  for (int i = 2; i * i < 500; i++) {
    if (is_prime[i]) {
      for (int j = i * i; j < 500; j += i) {
        is_prime[j] = false;
      }
    }
  }
  for (int i = 2; i < 500; i++) {
    if (is_prime[i]) {
      p.push_back(i);
    }
  }
}
long long int Pow(long long int a, long long int n) {
  if (n == 0) return 1;
  long long int q = Pow(a, n / 2);
  q = q * q;
  if (n & 1) q = q * a;
  return q;
}
int main() {
  init();
  int n;
  cin >> n;
  long long res = 1;
  vector<vector<int>> cnt(MAX);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int prime : p) {
      int c = 0;
      while (x % prime == 0) {
        x /= prime;
        c++;
      }
      cnt[prime].push_back(c);
    }
    if (x > 1) {
      cnt[x].push_back(1);
    }
  }
  for (int i = 2; i < MAX; i++) {
    if (cnt[i].size() == n - 1) {
      cnt[i].push_back(0);
    }
  }
  for (int i = 2; i < MAX; i++) {
    sort(cnt[i].begin(), cnt[i].end());
  }
  for (int i = 1; i < MAX; i++) {
    if (cnt[i].size() == n) {
      res *= Pow(i, max(cnt[i][0], cnt[i][1]));
    }
  }
  cout << res << "\n";
  return 0;
}
