n = gets.to_i
a = gets.split.map(&:to_i)
lcum = [0]
rcum = [0]
l = r = max = 0

(n - 1).times do |i|
  lcum << (l = a[i].gcd(l))
  rcum << (r = a[-1 - i].gcd((r)))
end

n.times do |i|
  tmp = lcum[i].gcd(rcum[n - 1 - i])
  max = tmp if max < tmp
end

puts max