// 最大公約数
_gcd = function(m, n, t) {
	while (m % n !== 0) {
		t = n;
		n = m % n;
		m = t;
	}
	return n;
}

input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
A = lines.shift().split(' ')

B = []
g = A[0]
B[0] = g
for (i=1; i<N; i++) {
    B[i] = _gcd(g, A[i])
}
C = []

g = A[N -1]
C[N-1] = g
for (i=N - 2; i >=0; i--) {
    C[i] = _gcd(g, A[i])
}

max = Math.max(C[1], B[N-2]) 
console.log(B, C)

for (i=0; i<A.length-2; i++) {
    gcd = _gcd(B[i], C[i+2])
    if (max < gcd) {
        max = gcd
    }
}

console.log(max)