Stock Exchange#1366

Stock Exchange

1 second
128 megabytes
Very easy

John is a stock market analyst who closely follows market trends. He tracks stock prices every day looking for rising trends. Given a sequence of numbers p_1, p_2, \ldots, p_n representing stock prices, a rising trend is a subsequence p_{i_1} < p_{i_2} < \dots < p_{i_k} with i_1 < i_2 < \dots < i_k. John's task is to find the longest rising trend.

Input

Each data set stands for a particular set of stock prices. A data set starts with the length (L \le 10^5) of the sequence of numbers, followed by integers.

White spaces can occur freely in the input. The input data are correct and terminate with an end of file.

Output

Print the length of the longest rising trend. For each data set, print the answer on a new line.

Examples

There are three data sets. In the first case, the length of the sequence is . The sequence is 5, 2, 1, 4, 5, 3. The length of the longest rising trend is .

Example 1

Loading
Loading