Problems
Increasing subsequence
Increasing subsequence
Given $n$ integers $x_1, x_2, ..., x_n$. Delete from them the least number of integers so that the rest were in ascending order.
\InputFile
The first line contains the number $n~(1 \le n \le 10^5)$. The second line contains the integers $x_1, x_2, ..., x_n~(1 \le x_i \le 60000)$.
\OutputFile
Print in the first line the number of not erased integers. In the second line print the list of unerased integers in the original order. If several answers exist, print any.
Input example #1
6 2 5 3 4 6 1
Output example #1
4 2 3 4 6