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;
  }
}

auto nullable(T)(T x) {
  return Nullable!T(x);
}

void main() {
  long N = read_num!long;
  long[] A = read_nums!long;

  long ans = -1;

  // 削除候補
  for (size_t i = 0; i < N; i++) {
    Nullable!long a;
    long b;
    for (size_t j = 0; j < N; j++) {
      if (i == j) {
        continue;
      }

      if (a.isNull) {
        a = A[j].nullable;
      } else {
        b = A[j];
        a = gcd(a.get, b).nullable;
      }
    }

    chmax(ans, a.get);
  }

  writeln(ans);
}