#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
using piii = pair<pair<int, int>, int>;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
void solve() {
  ll n, k = 1e12, b = 0;
  cin >> n;
  vl a(n), suf(n, 0);
  for (int i = (0); i < (n); i++) cin >> a[i];
  suf[n - 1] = a[n - 1];
  for (int i = (n - 2); i > (0); i--) {
    suf[i] = gcd(a[i], suf[i + 1]);
  }
  for (int i = (0); i < (n - 1); i++) {
    if (b == 0) {
      k = (a[i] * suf[i + 1]) / gcd(a[i], suf[i + 1]);
      b++;
    } else {
      ll x = (a[i] * suf[i + 1]) / gcd(a[i], suf[i + 1]);
      k = gcd(x, k);
    }
  }
  cout << k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
