n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
l = Array.new(n+1,0)
r = Array.new(n+1,0)
n.times do |i|
 l[i+1] = l[i].gcd(a[i])
 r[-2-i] = r[-1-i].gcd(a[-1-i])
end
max = 1
n.times do |i|
  max = [l[i].gcd(r[i+1]),max].max
end
puts max