gets nums = gets.split.map(&:to_i) puts nums.uniq.each_with_object({}) { |n, hash| hash[n] = nums.count(n) }.count { |_, c| c == 1 }