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

f = []
n.times do |i|
  if i == 0
    f.push(a[i])
  else
    f.push(f[i-1].gcd(a[i]))
  end
end

e = []
b = a.reverse
n.times do |i|
  if i == 0
    e.push(b[i])
  else
    e.push(e[i-1].gcd(b[i]))
  end
end

gcds = []
n.times do |i|
  if i == 0
    gcds.push(e[n-2])
  elsif i == n - 1
    gcds.push(f[n-2])
  else
    gcds.push(f[i-1].gcd(e[n-i-2]))
  end
end
p gcds.max
