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

def gcd(x, y)
  if y == 0
    x
  else
    gcd(y, x % y)
  end
end

if n == 2
  puts a.max
  exit
end

puts a.combination(2).map { |x, y| gcd(x, y) }.max
