#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);
}
int32_t main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> v(n);
  v[n - 1] = a[n - 1];
  for (long long i = n - 2; i >= 0; i--) {
    v[i] = gcd(v[i + 1], a[i]);
  }
  vector<long long> k(n);
  for (long long i = 0; i < n - 1; i++) {
    k[i] = a[i] * v[i + 1] / v[i];
  }
  long long ans = k[0];
  for (long long i = 1; i < n - 1; i++) {
    ans = gcd(ans, k[i]);
  }
  cout << ans;
}
