#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, i, a[100005], suf[100005];
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = n; i >= 1; i--) suf[i] = gcd(suf[i + 1], a[i]);
  ll ans = 0;
  for (i = 1; i <= n - 1; i++)
    ans = gcd(ans, a[i] / gcd(a[i], suf[i + 1]) * suf[i + 1]);
  cout << ans << endl;
  return 0;
}
