Height of the Tree#2312

Height of the Tree

1 second
64 megabytes
Easy

Implement a binary search tree for integers. The program receives a sequence of integers and builds a tree from them. Elements are inserted into the tree according to the search results for their place. If an element already exists in the tree, do not add it. The tree is not balanced.

Find the height of the resulting tree.

Input

The input is a sequence of integers. The sequence ends with the number , which denotes the end of input and should not be added to the tree. It is guaranteed that the sequence contains no more than 10^5 numbers, each of modulus not exceeding 2 \cdot 10^9.

Output

Output a single number: the height of the constructed tree.

The example corresponds to the following tree:

Note that the height of the tree is measured in vertices.

Examples

Example 1

Loading
Loading