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

yakusu_arr = arr.map do |a|
  create_yakusu_arr(a)
end

puts yakusu_arr.map(&:to_a).flatten.group_by(&:itself).select{|k, v| v.size >= n - 1}.map{|k, v| k}.max

