"use strict";
    
const gcd = (a, b) => {
    return b ? gcd(b, a % b) : a;    
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    // 累積GCD
    let left  = [...Array(N + 1)].fill(0);
    let right = [...Array(N + 1)].fill(0);
    
    for(let i=0; i<N; i++) {
        left[i + 1] = gcd(left[i], A[i]);
    }
    
    for(let i=N-1; i>=0; i--) {
        right[i] = gcd(right[i+1], A[i]);
    }

    // 集計する
    let answer = 0;
    
    for(let i=0; i<N; i++) {
        // 左側
        let l = left[i];
        // 右側
        let r = right[i + 1];
        
        // 更新
        answer = Math.max(answer, gcd(l, r));
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
