func gcd(x: Int, _ y: Int) -> Int {
    return y>0 ? gcd(y, x%y) : x
}
let N = Int(readLine()!)!
let A = readLine()!.characters.split(" ").map{Int(String($0))!}
var L = [0]
var R = [0]
for i in 0..<N {
    L += [gcd(L[i], A[i])]
    R += [gcd(R[i], A[N-i-1])]
}
print((0..<N).map{gcd(L[i], R[N-i-1])}.maxElement()!)