n=gets.to_i
a=gets.split.map(&:to_i).sort
require 'prime'

class Integer
  def my_divisor_list
    divisors = [1]
    primes = []
    Prime.prime_division(self).each do |prime|
      prime[1].times {primes << prime[0]}
    end

    1.upto(primes.size) do |i|
      primes.combination(i) do |prime|
        divisors << prime.inject{|a,b| a *= b}
      end
    end

    divisors.uniq!
    divisors.sort!
    return divisors
  rescue ZeroDivisionError
    return
  end
end

for f in a[-1].my_divisor_list.reverse+[2]
	if a.delete_if{|i|i%f==0}.size==0||a.delete_if{|i|i%f==0}.size==1
		p f;exit
	end
end