#BS0000018. Dãy con tăng dài nhất (Increasing Subsequence)
Dãy con tăng dài nhất (Increasing Subsequence)
Increasing Subsequence
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
Given an array of integers, find the length of the longest strictly increasing subsequence. A subsequence is obtained by deleting some elements without changing the order of the remaining elements.
Input
The first line contains .
The second line contains integers.
Output
Print the length of the longest strictly increasing subsequence.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , .
Examples
Input
8
7 3 5 3 6 2 9 8
Output
4
Explanation
For example, is a strictly increasing subsequence of length .