items = Hash.new(0) gets.to_i.times do gets.split.map(&:to_i).each do |i| items[i] += 1 end end count = 0 items.each do |key, i| count += i/2 items[key] = i % 2 end count += items.values.inject(:+)/4 puts count