Problem
You are an engineer in Blocktopia, a land of skyscrapers built with building blocks. Each block has a size (an integer value). You are not allowed to rearrange the blocks — you must use a continuous subsequence. You can only stack blocks following these rules:
- A block can be placed on top of another only if it is of the same or smaller size than the one below it.
Your task is to:
- Find the length of the longest continuous subsequence where each block is less than or equal to the previous one.
That length will be the maximum height of a stable tower.
Input
The input consists of two lines:
- The first line contains an integer n, the number of building blocks.
- The second line contains n space-separated integers representing the sizes of the blocks in the given order.
The input will be read from the STDIN by the candidate.
Output
Print a single integer: the maximum height of a tower that can be built from a continuous subsequence.
The output will be matched to the candidate's output printed on the STDOUT.
Constraints:
- 1 ≤ n ≤ 10^4
- 1 ≤ size[i] ≤ 10^6