#C12617. Count Unique Elements

    ID: 42064 Type: Default 1000ms 256MiB

Count Unique Elements

Count Unique Elements

You are given a list of integers and your task is to count the number of unique elements in that list. In other words, if the list is denoted by L, you need to compute the value of \(|\{x \mid x \in L\}|\), which represents the number of distinct elements.

This problem is straightforward and serves as a good exercise in handling arrays and using set data structures. Make sure to read the entire input from standard input (stdin) and print the result on standard output (stdout).

inputFormat

The first line of input contains an integer n representing the number of elements in the list. The second line contains n space-separated integers.

For example:

6
1 2 3 2 1 4

outputFormat

Output a single integer which is the number of unique elements in the given list.

For the sample input above, the output should be:

4
## sample
6
1 2 3 2 1 4
4

</p>