def divisors(n)
  b = Array.new
  for i in 1..((n**0.5))
    if n % i == 0
      b.push(i)
    end
  end
  len = b.length
  len.times do |i|
    if n/b[len-1-i] != b[len-1-i]
      b.push(n/b[len-1-i])
    end
  end
  b
end
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
div_cnt = Hash.new(0)
gcd_list = []
a.each do |x|
  divisors(x).each do |y|
    div_cnt[y] += 1
    if div_cnt[y] == n-1
      gcd_list << y
    end
  end
end
puts gcd_list.max