#include <bits/stdc++.h>
using namespace std;
vector<long long int> spf(200001);
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < 200001; i++) spf[i] = i;
  for (int i = 4; i < 200001; i += 2) spf[i] = 2;
  for (int i = 3; i * i < 200001; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < 200001; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int tt = 1, n, m, k = 0, i, j;
  long long int q, l = 0, r = 0, x, y, z, h, a, b, c, d;
  bool poss = true;
  long long int ans = 0, cur = 0, val;
  long long int N = 200001;
  vector<long long int> primes;
  vector<long long int> vis(N, 0);
  for (i = 2; i < N; i++) {
    if (vis[i]) continue;
    primes.push_back(i);
    for (j = i * i; j < N; j += i) {
      vis[j] = 1;
    }
  }
  sieve();
  for (int _ = 1; _ <= tt; _++) {
    cin >> n;
    vector<long long int> a(n);
    for (auto &z : a) cin >> z;
    sort(a.begin(), a.end(), greater<int>());
    vector<vector<long long int> > powers(N, vector<long long int>(2, 30));
    vector<long long int> exist(N, 0);
    for (i = 0; i < n; i++) {
      long long int b = a[i];
      while (b != 1) {
        long long int p = spf[b];
        long long int po = 0;
        while (b > 1 and b % p == 0) {
          po++;
          b /= p;
        }
        if (powers[p][1] > po) {
          powers[p][0] = powers[p][1];
          powers[p][1] = po;
        } else if (powers[p][0] > po) {
          powers[p][0] = po;
        }
        exist[p]++;
      }
    }
    long long int gcd = 1;
    for (auto &p : primes) {
      if (exist[p] < n - 1) continue;
      if (exist[p] == n - 1) {
        gcd *= pow(p, powers[p][1]);
      } else {
        gcd *= pow(p, powers[p][0]);
      }
    }
    cout << gcd << "\n";
  }
  return 0;
}
