Increasing subsequence
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given integers . Delete from them the least number of integers so that the rest were in ascending order.
Input
The first line contains the number . The second line contains the integers .
Output
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.
Examples
Input #1
Answer #1
Submissions 4K
Acceptance rate 24%