LearnPy Hub
← Arena
AdvancedRating 1500

Longest Increasing Subsequence

Print the length of the longest strictly increasing subsequence (n ≤ 10⁵).

Input

n, then n integers.

Output

A length.

Sample 1

Input
8
10 9 2 5 3 7 101 18
Output
4

Sample 2

Input
6
0 1 0 3 2 3
Output
4
solution.py
Output appears here
Longest Increasing Subsequence · Python Arena problem · LearnPy Hub