#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);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int32_t main() {
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
    }
    long long pre[n], suf[n];
    pre[0] = arr[0];
    suf[n - 1] = arr[n - 1];
    for (long long i = 1; i < n; i++) {
      pre[i] = gcd(pre[i - 1], arr[i]);
    }
    for (long long i = n - 2; i >= 0; i--) {
      suf[i] = gcd(suf[i + 1], arr[i]);
    }
    long long di[n];
    di[0] = suf[1];
    di[n - 1] = pre[n - 2];
    for (long long i = 1; i < n - 1; i++) {
      di[i] = gcd(pre[i - 1], suf[i + 1]);
    }
    long long ans = 1;
    for (long long i = 0; i < n; i++) {
      ans = lcm(ans, di[i]);
    }
    cout << ans << endl;
  }
}
