All problems

Overlapping (Not Side-by-Side) Categories With dodge=False

hardPythonSeaborndodge

The Ravensworth Group splits each team's scores again by shift, so a record now carries a team and a shift. By default the chart pushes the shifts apart into their own slots inside each team's column; this report instead stacks them at the same position and separates them by colour alone. Either way the legend has to list every team-and-shift combination that actually occurs.

Task: Print how many distinct team-and-shift combinations appear.

Input

The first line holds one integer n, the number of records, where 1 <= n <= 1000. Then come n lines, each holding a team label, a shift label and a score, separated by single spaces. Labels contain no spaces, and the same combination may appear on several lines.

Output

One line holding a whole number: how many different team-and-shift combinations occur. A combination filing three records counts once, and a combination that never occurs is not counted at all.

Example:

Input:
4
A X 10
A Y 20
B X 15
A X 30

Output:
3

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…