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

left = Array.new(n + 1,0)
right = Array.new(n + 1,0)

(0..n - 1).each do |i|
  left[i + 1] = left[i].gcd(ns[i])
end

(n - 1).downto(0) do |i|
  right[i] = right[i+1].gcd(ns[i])
end

ans = 0

(0..n - 1).each do |i|
   left_ans = left[i]
   right_ans = right[i + 1]
   ans = [ans, left_ans.gcd(right_ans)].max
end

puts ans