#arc159d. [arc159_d]LIS 2
[arc159_d]LIS 2
Problem Statement
We have a sequence , which is initially empty.
Takahashi has performed the following operation for in this order.
- Append in this order to the end of .
Find the greatest length of a strictly increasing subsequence of the final .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
1 1
2 4
10 11
7 10
Sample Output 1
8
The final is .
The -st, -nd, -rd, -th, -th, -th, -th, and -th elements form a strictly increasing subsequence with the greatest length.
Sample Input 2
4
1 1
1 1
1 1
1 1
Sample Output 2
1
The final is .
Sample Input 3
1
1 1000000000
Sample Output 3
1000000000