const gcd = (a, b) => {
    if (b === 0) return a;
    else if (a === 0) return b;
    return gcd(b, a%b);
}

const initGCD = (n, a) => {
    let L = [...new Array(n)].fill(0)// aをiで分けたときの左部分GCD
    let R = [...new Array(n)].fill(0)// aをiで分けたときの右部分GCD
    L[0] = R[n-1] = 0
    for(let i=1; i<n; i++) {
        L[i] = gcd(L[i-1], a[i-1])
        R[n-i-1] = gcd(R[n-i], a[n-i])
    }
    return [L,R]
}

const main = (arg) => {
    const n = Number(arg.split("\n")[0])
    const a = arg.split("\n")[1].split(" ").map(Number)

    const [L,R] = initGCD(n, a)

    const m = [...new Array(n)].fill(0)// gcd when ai is excluded
    for(let i=0; i<n; i++) {
        m[i] = gcd(L[i],R[i])
    }
    console.log(Math.max(...m))
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));