#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int a[N], s1[N], s2[N], t[N];
map<long long, int> ma;
long long gcd(long long x, long long y) { return !y ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return x * y / (gcd(x, y)); }
map<long long, int> mt;
int main() {
  int n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  s1[1] = a[1];
  for (int i = 2; i <= n; ++i) s1[i] = gcd(a[i], s1[i - 1]);
  s2[n] = a[n];
  for (int i = n - 1; i >= 1; --i) s2[i] = gcd(s2[i + 1], a[i]);
  for (int i = 1; i <= n; ++i) t[i] = gcd(s1[i - 1], s2[i + 1]);
  long long ans = 1;
  for (int i = 1; i <= n; ++i) {
    mt.clear();
    for (int j = 1; j * j <= a[i]; ++j) {
      if (a[i] % j == 0) {
        long long k = lcm(t[i], j);
        if (!mt[k]) {
          if (++ma[k] == n) ans = max(ans, k);
          mt[k] = 1;
        }
        if (j * j != a[i]) {
          k = lcm(t[i], a[i] / j);
          if (!mt[k]) {
            if (++ma[k] == n) ans = max(ans, k);
            mt[k] = 1;
          }
        }
      }
    }
  }
  cout << ans;
  return 0;
}
