N = gets.to_i inventory = [0] * 11 $<.map{|s| gained = s.split.take(3).map(&:to_i) gained.each{|item| inventory[item] += 1 } } res = 0 inventory.map!{|count| cnt, rest = count.divmod(2) res += cnt rest } res += inventory.sum / 4 p res