#include <bits/stdc++.h>
using namespace std;
map<long long int, vector<long long int>> prime;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  for (long long int i = 0; i < n; i++) {
    long long int num = arr[i];
    for (long long int j = 2; j <= sqrt(num); j++) {
      long long int cnt = 0;
      while (num % j == 0) {
        num /= j;
        cnt++;
      }
      if (cnt > 0) prime[j].push_back(cnt);
    }
    if (num > 0) prime[num].push_back(1);
  }
  long long int ans = 1;
  for (auto p : prime) {
    vector<long long int> v = p.second;
    sort(v.begin(), v.end());
    if (v.size() >= n - 1) {
      long long int pw;
      if (v.size() == n - 1)
        pw = v[0];
      else
        pw = v[1];
      while (pw--) {
        ans *= p.first;
      }
    }
  }
  cout << ans << endl;
}
