#BS0000017. Các tháp khối (Towers)
Các tháp khối (Towers)
Towers
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
You receive cubes in a fixed order. A cube may be placed on an existing tower only if it is strictly smaller than the current top cube. Each cube must be processed immediately: place it on a tower or start a new tower. Find the minimum possible number of towers.
Input
The first line contains .
The second line contains cube sizes .
Output
Print the minimum number of towers.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , .
Examples
Input
5
3 8 2 1 5
Output
2
Explanation
Two towers are sufficient, and the arrival order prevents using only one.