A web server logs n visitor ID tokens over one day (the same visitor may be logged multiple times). Count how many distinct visitor IDs appear in the log.
Line 1: an integer n.
Line 2: n space-separated visitor ID tokens (case-sensitive alphanumeric strings, no spaces inside a token).
A single integer: the number of distinct visitor IDs.
Example 1
Input
5 u1 u2 u1 u3 u2
Expected
3
Explanation
The distinct IDs are u1, u2, and u3 — three in total, even though u1 and u2 each appear twice.
Example 2
Input
1 abc
Expected
1
Explanation
Only one ID is logged, so there is exactly one distinct visitor.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →