n = (gets || "").chomp.to_i items = {} of Int32 => Int32 n.times do a, b, c = (gets || "").chomp.split.map { |i| i.to_i } items[a] ||= 0 items[b] ||= 0 items[c] ||= 0 items[a] += 1 items[b] += 1 items[c] += 1 end power_up = 0 remain = 0 items.each do |_, value| power_up += value / 2 remain += value % 2 end p power_up + remain / 4