#K13731. Longest Increasing Subsequence Length

    ID: 23978 Type: Default 1000ms 256MiB

Longest Increasing Subsequence Length

Longest Increasing Subsequence Length

Given a sequence of integers, your task is to compute the length of the longest strictly increasing subsequence. A subsequence is a sequence derived from the array by deleting some or no elements without changing the order of the remaining elements.

For example, consider the sequence \( [5, 2, 8, 6, 3, 6] \). The longest strictly increasing subsequence is \( [2, 3, 6] \) with a length of 3.

Note: The subsequence must be strictly increasing, meaning each subsequent element is greater than the previous one.

inputFormat

The input is given via standard input (stdin) in the following format:

n
num1 num2 ... numn

Where n is the number of elements. If n is 0, the array is empty.

outputFormat

Output a single integer to standard output (stdout) representing the length of the longest strictly increasing subsequence in the given array.

## sample
5
1 2 3 4 5
5