NOI Contest Archive

Archive / 2026 / Qualifier Round

Petra and Rising Garden

Medium · NOI 2026 Qualifier Round

In a magical garden, there are \(N\) enchanted plants arranged in a straight line. Each plant has a certain growth level.

Petra wants to create a beautiful sequence of plants such that:

Find the maximum number of plants Petra can pick to form such a sequence.

Input Format

Output Format

Print a single integer — the length of the longest beautiful sequence that Perta can obtain.

Constraints

Sample Input 0

5
2
7
4
3
8

Sample Output 0

3