#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n];
  vector<long long> prime(200010);
  vector<long long> temp;
  for (long long i = 2; i <= sqrt(200010); i++) {
    if (prime[i] == 1) continue;
    for (long long j = 2; i * j < 200010; j++) prime[i * j] = 1;
  }
  for (long long i = 2; i < 200010; i++) {
    if (prime[i] == 0) temp.push_back(i);
  }
  for (long long i = 0; i < n; i++) cin >> arr[i];
  map<long long, vector<long long> > m;
  for (long long i = 0; i < n; i++) {
    long long a = arr[i];
    for (long long j = 0; j < temp.size(); j++) {
      if (a == 1) break;
      long long c = 0;
      if (temp[j] > sqrt(a)) {
        m[a].push_back(1);
        break;
      }
      while (a % temp[j] == 0 && a != 1) {
        a /= temp[j];
        c++;
      }
      if (c) m[temp[j]].push_back(c);
    }
  }
  long long ans = 1;
  for (long long i = 0; i < temp.size(); i++) {
    if (m[temp[i]].size() < n - 1) continue;
    sort(m[temp[i]].begin(), m[temp[i]].end());
    long long o;
    if (m[temp[i]].size() == n - 1)
      o = m[temp[i]][0];
    else
      o = m[temp[i]][1];
    while (o--) ans = ans * temp[i];
  }
  cout << ans;
  return 0;
}
