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

gl = a[0]
gr = a[-1]
l = [0]
r = [0]

n.times do |i|
  gl = gl.gcd(a[i])
  gr = gr.gcd(a[n - 1 - i])
  l << gl
  r.unshift(gr)
end

m = []
n.times do |i|
  if l[i] == 0
    m << r[i + 1]
  elsif r[i + 1] == 0
    m << l[i]
  else
    m << l[i].gcd(r[i + 1])
  end
end
puts m.max