P3536 Longest Ordered Subsequence
A numeric sequence of ai is ordered if . Let the subsequence of the given numeric sequence be any sequence , where . For example, sequence has ordered subsequences, e. g., and many others. All longest ordered subsequences are of length , e. g., .
Your program, when given the numeric sequence, must find the length of its longest ordered subsequence.
The first line of input file contains the length of sequence . The second line contains the elements of sequence - integers in the range from to each, separated by spaces. .
Output file must contain a single integer - the length of the longest ordered subsequence of the given sequence.