#C5798. Maximum Stack Height

    ID: 49486 Type: Default 1000ms 256MiB

Maximum Stack Height

Maximum Stack Height

You are given \(N\) boxes, each with a positive integer weight. A box can be placed on top of another if its weight is greater than or equal to the weight of the box immediately below it. In mathematical terms, if the boxes are arranged as \(a_1, a_2, \ldots, a_N\) such that \(a_1 \le a_2 \le \cdots \le a_N\), then the stacking is valid.

Your task is to determine the maximum height of the stack that can be formed by stacking the boxes in a valid order. Although the procedure may seem trivial because sorting always gives you a valid sequence, you are required to implement the solution as described.

Note: You must read input from stdin and output the result to stdout.

inputFormat

The first line consists of a single integer \(N\) representing the number of boxes. The second line contains \(N\) space-separated integers, each denoting the weight of a box.

outputFormat

Output a single integer — the maximum height of the stack that can be achieved.

## sample
6
4 3 1 2 5 6
6

</p>