list = Array.new power_up = 0 gets.chomp.to_i.times { gets.chomp.split.map(&:to_i).each{ |i| list << i } } list.uniq.each do |i| power_up += list.count(i) / 2 list.delete(i) if list.count(i).even? end puts power_up + list.uniq.length / 4