n = gets.to_i
as = gets.split.map(&:to_i)

ls = Array.new(n+2, 0)
rs = Array.new(n+2, 0)

1.upto(n) do |i|
  ls[i] = ls[i-1].gcd(as[i-1])
end
n.downto(1) do |i|
  rs[i] = rs[i+1].gcd(as[i-1])
end

puts (1..n).map {|i| rs[i+1].gcd(ls[i-1])}.max
