1178: 最长不下降序列

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:20 Solved:8

Description

      设有整数序列b1,b2,b3,…,bm,若存在i1<i2<i3<…<in,且bi1<bi2<bi3<…<bin,则称b1,b2,b3,…,bm中有长度为n的不下降序列bi1,bi2,bi3,…,bin。求序列b1,b2,b3,…,bm中所有长度(n)最大不下降子序列

Input

第一行一个整数M (M<=10000)

接下来输入M个用空格隔开的整数(<=20000)序列

Output

一行一个整数,表示最大长度n

Sample Input Copy

11
3 6 5 2 7 8 4 1 9 10 11 

Sample Output Copy

7