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

def gcd(a, b)
  if a < b then
    tmp = a
    a = b
    b = tmp
  end
  r = a % b
  while r != 0 do
    a = b
    b = r
    r = a % b
  end
  return b
end

max = 0
n.times do |i|
  g = nil
  arr.each_with_index do |a, j|
    next if i == j
    if g.nil? then
      g = a
    else
      g = gcd(g, a)
    end
  end
  max = g if g > max
end

puts max

