import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int[] xs) {
    auto left = new int[xs.length];
    auto right = new int[xs.length];

    left[0] = xs[0];
    for (int i = 1; i < xs.length; i++)
        left[i] = gcd(xs[i], left[i-1]);

    right[$-1] = xs[$-1];
    for (int i = cast(int)xs.length-2; i >= 0; i--) {
        right[i] = gcd(xs[i], right[i+1]);
    }

    int ans = max(left[$-2], // 右端を消す
                  right[1]); // 左端を消す
    for (int i = 1; i <= xs.length - 2; i++) {
        // 両端以外を消す
        int g = gcd(left[i-1], right[i+1]);
        ans = max(ans, g);
    }
    return ans;
}

void main() {
    readint;
    auto xs = readints;
    writeln(calc(xs));
}

T gcd(T)(T a, T b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
