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

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

max = [ls[-2],rs[-2]].max
(N-2).times do |i|
    n = ls[i].gcd(rs[-3-i])
    max = n if max < n
end

puts max