n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

ans = 1
left = Array.new(n,0)
right = Array.new(n,0)
left[0] = a.first
right[n-1] = a.last

1.upto(n-1).each do |i|
  left[i] = left[i-1].gcd(a[i])
end
(n-2).downto(0).each do |i|
  right[i] = right[i+1].gcd(a[i])
end

ans = 0
1.upto(n-2) do |i|
  # p [left[i-1], right[i+1]]
  ans = [ans, left[i-1].gcd(right[i+1])].max
end

puts [ans, left[n-2], right[1]].max