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;

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

int calc(int[] a) {
    int n = cast(int)a.length;

    // lt[i] = A_0, A_1, ..., A_{i-1} の最大公約数
    auto lt = new int[n + 1];
    // rt[i] = A_i, A_{i+1}, ..., A_{N-1} の最大公約数
    auto rt = new int[n + 1];

    for (int i = 0; i < n; i++)
        lt[i + 1] = gcd(lt[i], a[i]);

    for (int i = n - 1; i >= 0; i--)
        rt[i] = gcd(rt[i + 1], a[i]);

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = max(ans, gcd(lt[i], rt[i + 1]));
    }
    return ans;
}

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