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

def gcd(i_1,i_2)
  i_1,i_2 = i_1 > i_2 ? [i_1,i_2] : [i_2,i_1]
  amari = i_1 % i_2
  return i_2 if amari == 0
  gcd(i_2,amari)
end

max = 0
n.times do |i|
  tryal_arr = a_arr.clone
  tryal_arr.delete_at(i)
  try = tryal_arr.inject(&:gcd)
  max = try if try > max
end

puts max
