Farmer John needs to sort his cows, conveniently numbered from to , before they head out to the pasture for breakfast.
Currently, the cows are standing in a line in the order p_1, p_2, \ldots, p_n, and Farmer John is standing in front of cow p_1. He wants to reorder the cows so that they stand in the order 1, 2, \ldots, n, with cow closest to him.
The cows are a bit sleepy today, so at any moment the only cow paying attention to Farmer John's instructions is the cow directly facing him. In one time step, he can instruct this cow to move positions down the line, for any integer with 1 \le c \le n - 1. The cows she passes each move one step forward, making room for her to take her place right behind them.
For example, suppose that n = 4 and the cows start in the following order:
FJ: 4, 3, 2, 1The only cow paying attention to Farmer John is cow . If he instructs her to move positions down the line, the order becomes:
FJ: 3, 2, 4, 1Now the only cow paying attention to Farmer John is cow , and so on, until the cows are sorted.
Farmer John wants to finish sorting as soon as possible so that he can return to the farmhouse for his own breakfast. Help him find a sequence of instructions that sorts the cows in the minimum number of time steps.
The first line contains an integer n~(1 \le n \le 10^5) — the number of cows.
The second line contains distinct integers p_1, p_2, \ldots, p_n~(1 \le p_i \le n) — the initial order of the cows.
In the first line, print an integer — the minimum number of time steps required to sort the cows.
In the second line, print integers c_1, c_2, \ldots, c_k~(1 \le c_i \le n - 1) such that if at the -th step Farmer John instructs the cow facing him to move c_i positions down the line, then after steps the cows stand in the order 1, 2, \ldots, n.
If there are several optimal sequences of instructions, print any of them.
Example 1