import std.functional,
       std.algorithm,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.math;

N gcd(N)(N a, N b) if (isNumeric!N || is (N == Biglong)) { return a ? gcd(b % a, a) : b; }
T read_num(T)() { return readln.chomp.to!T; }
T[] read_nums(T)() { return readln.chomp.split.to!(T[]); }
bool chmax(T)(ref T a, T b) {
  if (a < b) {
    a = b;
    return true;
  } else {
    return false;
  }
}

void main() {
  long N = read_num!long;
  long[] A = read_nums!long;
  long ans = -1;
  long[] L, R;
  L.length = N;
  R.length = N;

  L[0] = A[0];
  for (size_t i = 1; i < N; i++) {
    L[i] = gcd(L[i - 1], A[i]);
  }
  R[N - 1] = A[N - 1];
  for (size_t i = N - 2; i > 0; i--) {
    R[i] = gcd(R[i + 1], A[i]);
  }

  foreach (i; 0..N) {
    long l = i > 0 ? L[i - 1] : 0;
    long r = i < N - 1 ? R[i + 1] : 0;
    chmax(ans, gcd(l, r));
  }

  writeln(ans);
}