LIS - Longest Increasing Subsequence#362

LIS - Longest Increasing Subsequence

1 second
128 megabytes
Medium (≈1350)

Find the length of the longest strictly increasing subsequence for the given sequence.

Input

The first line indicates the length of the sequence n~(1 \le n \le 1000). The second line contains the sequence itself. The numbers in the sequence are integers that do not exceed 10^4 in absolute value.

Output

Output the length of the longest strictly increasing subsequence.

Examples

Example 1

Loading
Loading