# https://atcoder.jp/contests/abc125/submissions/5142309
# https://twitter.com/armeria_betrue/status/1122134567765233665

N = gets.to_i
A = [0] + gets.split(' ').map(&:to_i)
gcd = []

left  = Array.new(N + 2, 0)
right = Array.new(N + 2, 0)

(1..N).each do |i|
  left[i] = left[i - 1].gcd(A[i])
end

N.downto(1).each do |i|
  right[i] = right[i + 1].gcd(A[i])
end

(1..N).each do |i|
  gcd.push(left[i - 1].gcd(right[i + 1]))
end

puts gcd.max