distinct-numbers

Table of Contents

Numbers"

Distinct Numbers

Next: [apartments](apartments.html)

You are given a list of n integers, and your task is to calculate the number of distinct values in the list.

Input

The first input line has an integer n: the number of values.

The second line has n integers x1,x2,...,xn.

Output

Print one integers: the number of distinct values.

Explanation

You are given a list of integers, and you want to count the unique ones. Collect the items into a set, and return the length of the set.

Solution

{{# include _include/code/algorithms/cses/cpp/sorting-and-searching/distinct-numbers.cc }}

Next: [apartments](apartments.html)