#include <bits/stdc++.h>
using namespace std;
long long MAX(long long a, long long b) { return a > b ? a : b; }
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) return MAX(a, b);
  return a % b == 0 ? b : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long suffix = a[n - 1];
  for (long long i = n - 2; i >= 0; i--) {
    long long at = lcm(a[i], suffix);
    ans = gcd(ans, at);
    suffix = gcd(suffix, a[i]);
  }
  cout << ans << endl;
  return 0;
}
