Increasing subsequence#832

Increasing subsequence

1 second
128 megabytes
Easy

Given integers x_1, x_2, \ldots, x_n. Remove the minimum number of integers so that the remaining numbers are in strictly increasing order.

Input

The first line contains an integer (1 \le n \le 10^5). The second line contains integers x_1, x_2, \ldots, x_n (1 \le x_i \le 60000).

Output

Print the number of integers that remain. On the second line, print the remaining integers in their original order. If there are several possible answers, print any of them.

Examples

Example 1

Loading
Loading