Number of elements
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Implement the binary search tree for integers. The program reads a sequence of integers and builds a tree from them. Elements are inserted to the tree according to the search results of their place. If the item already exists in the tree, do not add it. The balance operations on the tree are not performed.
Find the number of elements in the built tree.
Input
The program receives a sequence of integers. The sequence ends with the number 0, which means the end of input, do not add it to the tree. It is guaranteed that the input sequence contains no more than 10^5 numbers, each of them does not exceed 2·10^9 in absolute value.
Output
Print one number - the number of elements in the built tree.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 53%