Create an array
Ali loves to create a new array from scratch. Today, he wants to build an array of elements. Initially, he has an array containing zeros, and he can only apply the following operations to this array:
: This means that for all satisfying the condition . Of course, in this operation, the condition must be satisfied.
Now Ali is thinking about the minimum number of operations he can perform to obtain the array . Help Ali find the minimum number of operations and any sequence of such operations.
Input
The first line contains a single integer . The next line contains integers .
Output
Output the minimum number of operations required to obtain the array 𝑎 in the first line. Denote this number by . Output any sequence of operations in the following lines in the format .
Examples
Example 1. See how the array changes as operations are applied:
b[] = 0 0 0 0 0 0 0 0 b[] = 1 1 1 0 0 0 0 0 b[] = 1 7 1 0 0 0 0 0 b[] = 1 7 1 7 7 0 0 0 b[] = 1 7 1 7 7 2 2 2 b[] = 1 7 1 7 7 3 2 2 b[] = 1 7 1 7 7 3 2 3
It's impossible to obtain the given array in fewer than operations. There may be other correct sequences of operations.
Example 2.
b[] = 0 0 0 0 0 0 0 b[] = 0 0 1 1 1 1 0 b[] = 0 0 1 3 3 1 0