class Calc0029 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @n = args.shift.first.to_i @items = args.map { |l| l.map(&:to_i) } end def run is = @items.flatten.group_by(&:itself).map { |no, g| g.size } is.map { |i| i / 2 }.inject(:+) + is.select { |i| i % 2 == 1 }.size / 4 end end puts Calc0029.new(STDIN.readlines).run if __FILE__ == $0