import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if (N == 2) {
        A.reduce!max.writeln;
        return;
    }

    auto L = new long[](N);
    auto R = new long[](N);

    L[0] = A.front;
    R[N-1] = A.back;

    foreach (i; 1..N) L[i] = gcd(L[i-1], A[i]);
    foreach_reverse (i; 0..N-1) R[i] = gcd(R[i+1], A[i]);

    long ans = 1;

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

    ans.writeln;
}
