#include <bits/stdc++.h>
using namespace std;
long long int maxN = 1000000000000000000;
long long int res[100001];
long long int n;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    cin >> n;
    long long int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long int r = a[0];
    res[0] = a[0];
    for (int i = 1; i < n; i++) {
      r = gcd(r, a[i]);
      res[i] = r;
    }
    long long int ans = 1;
    for (int i = n - 1; i > 0; i--) {
      if (i == n - 1) {
        ans = (res[i - 1] / gcd(a[i], res[i - 1])) * a[i];
      } else {
        long long int k = (res[i - 1] / gcd(a[i], res[i - 1])) * a[i];
        ans = gcd(ans, k);
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
