class Integer
  def gcd(b)
    a = self
    a, b = b, a if a > b
    until a == 0
      a, b = b%a, a
    end
    b
  end
end

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

gmax = 0
n.times do |i|
  if i == 0
    g = a[1]
    n.times do |j|
      next if j <= 1
      g = a[j].gcd(g)
    end
  else
    g = a[0]
    n.times do |j|
      next if j == 0 || j == i
      g = a[j].gcd(g)
    end
  end
  gmax = g if g > gmax
end
puts gmax