문제
Farmer John is attempting to sort his
Currently, the cows are standing in a line in the order
Today the cows are a bit sleepy, so at any point in time the only cow who is paying attention to Farmer John's instructions is the cow directly facing Farmer John. In one time step, he can instruct this cow to move
For example, suppose that
FJ: 4, 3, 2, 1
The only cow paying attention to FJ is cow $4$. If he instructs her to move $2$ paces down the line, the order will subsequently look like this:
FJ: 3, 2, 4, 1
Now the only cow paying attention to FJ is cow
Farmer John is eager to complete the sorting, so he can go back 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.
Problem credits: Dhruv Rohatgi
입력
The first line of input contains
출력
The first line should contain a single integer,
The second line should contain
If there are multiple optimal instruction sequences, your program may output any of them.
예제1
4
1 2 4 3
3
2 2 3