N,*as=$<.read.split.map(&:to_i)

n = as[0]
ls = as.map {|a| n = n.gcd(a) }
n = as[-1]
rs = as.reverse.map {|a| n = n.gcd(a) }.reverse

# p [ls,rs]

max = [ls[-2],rs[1]].max
i = 0
while i < N-2
    n = ls[i].gcd(rs[i+2])
    max = n if max < n
    i += 1
end

puts max