import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(int N, long[] A) {
    auto l = new long[](N);
    auto r = new long[](N);

    l[0] = A[0];
    r[$ - 1] = A[$ - 1];
    for (auto i = 0; i < N - 1; i++) {
        l[1 + i] = gcd(A[1 + i], l[i]);
        r[$ - 2 - i] = gcd(A[$ - 2 - i], r[$ - 1 - i]);
    }

    long ans;
    for (auto i = 0; i < N; i++) {
        if (i == 0) {
            ans = ans.max(r[1]);
        } else if (i == N - 1) {
            ans = ans.max(l[$ - 2]);
        } else {
            ans = ans.max(gcd(l[i - 1], r[i + 1]));
        }
    }

    return ans;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    int N;
    N = input.front.to!int;
    input.popFront;

    long[] A = new long[](N);
    foreach (i; 0 .. N) {
        A[i] = input.front.to!long;
        input.popFront;
    }

    static if (is(ReturnType!solve == void))
        solve(N, A);
    else
        solve(N, A).writeln;
}
