#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MAXN = 2e5 + 19;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  map<int, int> ma;
  for (int i = 0; i < (n); ++i) {
    int ai = a[i];
    if (ai % 2 == 0) {
      ma[2]++;
      while (ai % 2 == 0) ai /= 2;
    }
    for (long long j = 3; j * j <= ai; j += 2) {
      if (ai % j == 0) {
        ma[j]++;
        while (ai % j == 0) ai /= j;
      }
    }
    if (ai != 1) {
      ma[ai]++;
    }
  }
  vector<int> tp;
  for (auto it : ma) {
    if (it.second >= n - 1) {
      tp.push_back(it.first);
    }
  }
  long long ans = 1;
  for (int p : tp) {
    int c[3];
    c[0] = INT_MAX;
    c[1] = INT_MAX;
    c[2] = INT_MAX;
    for (int i = 0; i < (n); ++i) {
      c[2] = 1;
      int ai = a[i];
      while (ai % p == 0) {
        c[2] *= p;
        ai /= p;
      }
      if (c[2] < c[1]) swap(c[1], c[2]);
      if (c[1] < c[0]) swap(c[1], c[0]);
    }
    ans *= c[1];
  }
  cout << ans << endl;
  return 0;
}
