"use strict";
const gcd = (x,y) => y ? gcd(y, x%y) : x;
const main = input => {
    const n = parseInt(input[0],10), a = input[1].split(' ');
    for(let i=0; i<n; i++) {
        a[i] = parseInt(a[i], 10);
    }
    let l = new Array(n+1), r = new Array(n+1),w = new Array(n);
    l[0] = 0, r[n] = 0;
    
    for(let i=1; i<n+1; i++) {
        l[i] = gcd(l[i-1], a[i-1]);
        r[n-i] = gcd(r[n+1-i],a[n-i]);
    }
    for(let i=0; i<n; i++) {
        w[i] = gcd(l[i], r[i+1]);
    }
    console.log(Math.max.apply(null, w));
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));