#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(0);
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> new_a;
  long long old = a[n - 1];
  long long ans = 0;
  for (int i = n - 2; i >= 0; i--) {
    long long new_g = gcd(old, a[i]);
    long long res = (a[i] * old) / new_g;
    ans = gcd(ans, res);
    old = new_g;
  }
  cout << ans;
}
