N = gets.chomp.to_i
as = gets.chomp.split.map(&:to_i)
gcd_l = Array.new(N)
gcd_l[0] = as[0]
gcd_r = Array.new(N)
gcd_r[-1] = as[-1]

for i in 1..(N-1) do
    gcd_l[i] = gcd_l[i-1].gcd(as[i])
    gcd_r[N-1-i] = gcd_r[N-i].gcd(as[N-1-i])
end

max = 0
for i in 0..(N-1) do
    if i == 0
        max = [max, gcd_r[i+1]].max
    elsif i == N-1
        max = [max, gcd_l[i-1]].max
    else
        cmp = gcd_l[i-1].gcd(gcd_r[i+1])
        max = [max, cmp].max
    end
end
puts max
