#P3426. Towers
Towers
当前没有测试数据。
Description
You are given n cubes in a certain order, and your task is to build towers using them. Whenever two cubes are one on top of the other, the upper cube must be smaller than the lower cube.
You must process the cubes in the given order. You can always either place the cube on top of an existing tower, or begin a new tower. What is the minimum possible number of towers?
Input Format
The first input line contains an integer n: the number of cubes.
The next line contains n integers k1,k2,…,kn: the sizes of the cubes.
Output Format
Print one integer: the minimum number of towers.5
3 8 2 1 5
2