#include <bits/stdc++.h>
using namespace std;
long long n, a, x, cnt, ans = 1;
priority_queue<long long> pq[200001];
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    x = a;
    for (long long k = 2; k * k <= a; k++) {
      cnt = 0;
      while (x % k == 0) {
        x /= k;
        cnt++;
      }
      if (cnt != 0) pq[k].emplace(-cnt);
    }
    if (x > 1) pq[x].emplace(-1);
  }
  for (int i = 2; i < 200001; i++) {
    if (pq[i].empty()) continue;
    if (pq[i].size() == n - 1)
      x = -pq[i].top();
    else if (pq[i].size() == n) {
      x = -pq[i].top();
      pq[i].pop();
      x = max(-pq[i].top(), x);
    }
    if (pq[i].size() >= n - 1) ans *= pow(i, x);
  }
  cout << ans << '\n';
  return 0;
}
