#K88707. Min Heights Needed for Strictly Increasing Tree Plantation

    ID: 37368 Type: Default 1000ms 256MiB

Min Heights Needed for Strictly Increasing Tree Plantation

Min Heights Needed for Strictly Increasing Tree Plantation

You are given an integer ( n ), representing the number of trees that need to be planted in strictly increasing order of height, and a list of available tree heights. Your task is to determine the minimal number of different heights required to plant the trees in strictly increasing order. In other words, you should choose the smallest ( n ) unique heights from the available list and output how many unique heights you end up with.

For example, if ( n = 5 ) and the available heights are ( [1, 2, 2, 3, 4, 6] ), the unique sorted heights are ( [1, 2, 3, 4, 6] ) and the answer is ( 5 ).

inputFormat

The input is read from standard input (stdin) and consists of two lines.

The first line contains a single integer ( n ), the number of trees to be planted.

The second line contains space-separated integers representing the available tree heights.

outputFormat

Output to standard output (stdout) a single integer representing the minimal number of different heights required to plant the trees in strictly increasing order.## sample

5
1 2 2 3 4 6
5