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

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

max = 0

a.combination(2).each do |x, y|
  if x > y
    max = [max, Euclid(x, y)].max
  else
    max = [max, Euclid(y, x)].max
  end
end

puts max

