1250: 最长上升子序列Ⅰ

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:34 Solved:16

Description

给定一个长度为 $n$ 的整数序列。

请你选出一个该序列最长的严格单调递增的子序列,输出长度。

Input

第一行包含整数 $n$。

第二行包含 $n$ 个整数,中间以空格隔开,表示给定的序列。

Output

输出最长上升子序列的长度。

Sample Input Copy

5
4 1 -2 3 5

Sample Output Copy

3

HINT

数据范围:

$1≤n≤1000$,
$-10^9≤序列中元素≤10^9$

Source/Category