All problems

Coloring a Pair Plot by Category (hue)

mediumPythonSeabornhue

Thornbury Labs suspects its samples are not one population but several, so each sample now arrives tagged with the species it came from. The lab wants the grid of charts coloured by that tag, to see whether the species separate. Before the chart is drawn, the legend has to be sized, and that needs the number of colours.

Task: Print how many different species appear in the batch.

Input

The first line holds one integer n, the number of samples, where 1 <= n <= 1000. Then come n lines, each holding two measurements and a species tag, separated by single spaces. Species tags contain no spaces, and a species may be sampled any number of times.

Output

One line holding a whole number: how many distinct species tags there are. A species sampled fifty times still needs one colour, and counts once.

Example:

Input:
4
1 2 X
3 4 Y
5 6 X
7 8 Z

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…