n = gets.to_i ar = gets.split.map(&:to_i) answer = [] ar.each do |i| answer << (1..n).select { |j| j % i == 0 } end puts answer.flatten.uniq.size