#C4605. Longest Increasing Subsequence

    ID: 48162 Type: Default 1000ms 256MiB

Longest Increasing Subsequence

Longest Increasing Subsequence

You are given a sequence of integers. Your task is to determine the length of the longest strictly increasing subsequence in the sequence.

A strictly increasing subsequence is a sequence extracted from the original sequence (not necessarily contiguous) where every element is greater than the previous one.

For example, given the sequence [5, 2, 8, 6, 3, 6], one of the longest strictly increasing subsequences is [2, 3, 6] which has length 3.

inputFormat

The input is given via standard input. The first line contains a single integer N representing the number of elements in the sequence. The second line contains N space-separated integers.

outputFormat

Output a single integer to standard output, indicating the length of the longest strictly increasing subsequence.## sample

6
5 2 8 6 3 6
3

</p>