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

def gcd(a,b)
  return a if b == 0
  gcd(b,a%b)
end

max = 0
n.times do |i|
  tryal_arr = a_arr.select{|elm| elm != a_arr[i]}
  try = tryal_arr.inject(&:gcd)
  max = try if try > max
end

puts max
