#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int gcd (int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main () {
  int N;
  cin >> N;
  vector<int> a(N, 0);
  rep(i, N) cin >> a[i];
  vector<int> l(N), r(N);
  rep(i, N-1) l[i+1] = gcd(l[i], a[i]);
  for (int i = N-1; i >= 1; i--) r[i-1] = gcd(r[i], a[i]);
  int ans = 1;
  rep(i, N) ans = max(ans, gcd(l[i], r[i]));
  cout << ans << endl;
}