#0001E3

Numbers

Teacher has asked one of her pupils to find the length of Longest increasing subsequence. Increasing subsequence is considered some numbers of subsequence of sequence N, where the next number is bigger or equal to the last one.

Input
- natural number N (1 ≤ N ≤ 100 000),length of sequence N;
- N natural numbers A ( -1 000 000 000 ≤ A ≤ 1 000 000 000 ).

Output
-natural number L, Length of longest increasing subsequence



Input:
7
19049
17832
15002
25889
20771
29517
8048

Output:
3

Explanation: The longest increasing subsequence of this sequence is 15002,25889,29517



Input:
16
0
8
4
12
2
10
6
14
1
9
5
13
3
11
7
15

Output:
6

Explanation: The longest increasing subsequence of this sequence is 0, 2, 6, 9, 13, 15.

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.