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

max = 0
a.combination(a.length-1) do |c|
  gcd = c.first
  c[1..-1].each do |cc|
    gcd = gcd.gcd(cc)
    break if gcd < max
  end
  max = [max, gcd].max
end

puts max