#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> arr(100005);
vector<int> suff(100005);
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  suff[n - 1] = arr[n - 1];
  for (int i = n - 2; i >= 0; i--) suff[i] = gcd(arr[i], suff[i + 1]);
  long long res = 0;
  for (int i = 0; i < n - 1; i++) {
    long long curr = lcm((long long)arr[i], (long long)suff[i + 1]);
    if (res == 0)
      res = curr;
    else
      res = gcd(res, curr);
  }
  cout << res << endl;
}
