#include <bits/stdc++.h>
int n;
inline long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long a[100007], l[100007], r[100007];
int main() {
  scanf(" %d", &n);
  for (int i = 1; i <= n; ++i) scanf(" %I64d", &a[i]);
  l[1] = a[1], r[n] = a[n];
  for (int i = 1; i < n; ++i) l[i + 1] = gcd(l[i], a[i + 1]);
  for (int i = n; i > 1; --i) r[i - 1] = gcd(r[i], a[i - 1]);
  long long ans = lcm(r[2], l[n - 1]);
  for (int i = 2; i < n; ++i) ans = lcm(ans, gcd(l[i - 1], r[i + 1]));
  printf("%I64d\n", ans);
  return 0;
}
