gets answer = 0 table = Hash.new(0) readlines.map { |l| l.split.map(&:to_i) }.flatten.each do |n| table[n] += 1 end table.each do |k, v| answer += v / 2 table[k] = k % 2 end answer += table.values.inject(:+) / 4 puts answer