Problem7558-- [CSES Problem Set] Increasing Subsequence

7558: [CSES Problem Set] Increasing Subsequence

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

You are given an array containing $n$ integers. Your task is to determine the longest increasing subsequence in the array, i.e., the longest subsequence where every element is larger than the previous one.
A subsequence is a sequence that can be derived from the array by deleting some elements without changing the order of the remaining elements.

Input

The first line contains an integer $n$: the size of the array.
After this there are $n$ integers $x_1,x_2,\ldots,x_n$: the contents of the array.

Output

Print the length of the longest increasing subsequence.

Constraints

$1≤n≤2⋅10^5$
$1 \le x_i \le 10^9$

Sample 1 Input

8
7 3 5 3 6 2 9 8

Sample 1 Output

4

HINT

相同题目:CSES 1145

Source/Category