#include <bits/stdc++.h>
using namespace std;
const int N = 1E6 + 7;
long long a[N], res[N];
int n;
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  cin >> n;
  long long tmp;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    tmp = a[n];
  }
  for (int i = n - 1; i >= 1; --i) {
    res[i] = tmp * a[i] / gcd(tmp, a[i]);
    tmp = gcd(tmp, a[i]);
  }
  long long ans = res[1];
  for (int i = 1; i < n; ++i) ans = gcd(ans, res[i]);
  cout << ans;
}
