function checkAll(div, As) {
    var mod = 0
    var result = true;
    As.forEach(element => {
        if (element % div > 0) {
            mod++;
            if (mod > 1) {
                result = false;
            }
        }
    });
    return result;
}

function Main(input) {
    const N = parseInt(input.shift());
    var As = input.map(x => parseInt(x));

    As = As.sort((a, b) => { return a - b; }); // 昇順ソート

    var firstDiv = 0;
    var secondDiv = 0;

    for (var div = As[0]; div > 0; div--) {
        if (As[0] % div == 0) {
            // 約数なら
            if (checkAll(div, As)) {
                firstDiv = div;
                break;
            }
        }
    }

    for (var div = As[1]; div > firstDiv; div--) {
        if (As[1] % div == 0) {
            // 約数なら
            if (checkAll(div, As)) {
                secondDiv = div;
                break;
            }
        }
    }

    console.log(Math.max(firstDiv, secondDiv));
}

// 改行・空白で分割
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));