
"use strict";

process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    const n = parseInt(input[0], 10);
    const a = input[1].split(' ').map(function(value) { return parseInt(value, 10); });
    let l = Array(n + 1);
    let r = Array(n + 1);
    let ans = 0;

    l[0] = 0;
    for (let i = 1; i < n; i++) {
        l[i] = gcd(l[i - 1], a[i - 1]);
    }

    r[n - 1] = 0;
    for (let i = n - 2; i >= 0; i--) {
        r[i] = gcd(r[i + 1], a[i + 1]);
    }

    for (let i = 0; i < n; i++) {
        ans = Math.max(ans, gcd(l[i], r[i]));
    }

    console.log(ans);

    return 0;
}

function gcd(a, b) {

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