// 最大公約数
_gcd = function(m, n, t) {
    if (n == 0) {
        console.log(m, n)
        return m
    }
	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 = [0]
for (i=0; i<N; i++) {
    B[i+1] = _gcd(B[i], A[i])
}

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

max = 0
for (i=0; i<N; i++) {
    gcd = _gcd(B[i], C[i+1])
    if (max < gcd) {
        max = gcd
    }
}

console.log(max)
