require "set"

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

def create_yakusu_arr(num)
  return [1] if num == 1
  return (1..Math.sqrt(num).to_i).select {|i|
    num % i == 0
  }.map {|a| [a, num / a]}.flatten.uniq
end

hash = {}

arr.each do |a|
  set = Set.new
  (1..Math.sqrt(a).to_i).each do |i|
    if a % i == 0 then
      if !set.include?(i) then
        hash[i] = (hash[i] || 0) + 1
        set << i
      end
      if !set.include?(a / i) then
        b = a / i
        hash[b] = (hash[b] || 0) + 1
        set << b
      end
    end
  end
end

puts hash.select{|k, v| v >= n - 1}.keys.max

