#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  while (x > 0 && y > 0) {
    if (x > y)
      x %= y;
    else
      y %= x;
  }
  return x + y;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> A(n), l(n + 1, 0), r(n + 1, 0);
  for (auto &a : A) cin >> a;
  for (int i = 1; i <= n; ++i) {
    l[i] = gcd(l[i - 1], A[i - 1]);
    r[n - i] = gcd(r[n - i + 1], A[n - i]);
  }
  int res = 0, tmp;
  for (int i = 0; i < n; ++i) {
    tmp = gcd(l[i], r[i + 1]);
    if (tmp > res) res = tmp;
  }
  cout << res << endl;
  return 0;
}
