#arc110f. [arc110_f]Esoswap

[arc110_f]Esoswap

Problem Statement

We have a permutation P=P0,P1,ldots,PN1P = P_0, P_1, \\ldots, P_{N - 1} of 0,1,ldots,N10, 1, \\ldots, N - 1.

You can do the following operation on PP at most 2times1052 \\times 10^5 times:

  • Announce an integer i (0leqileqN1)i ~ (0 \\leq i \\leq N - 1). Swap PiP_i and P(i+Pi)textrmmodNP_{(i + P_i) \\textrm{ mod } N}.

Your task is to sort PP in ascending order with this operation. If it is impossible, print -1 instead.

Constraints

  • All values in input are integers.
  • 2leqNleq1002 \\leq N \\leq 100
  • PP is a permutation of 0,1,ldots,N10, 1, \\ldots, N - 1.

Input

Input is given from Standard Input in the following format:

NN P0P_0 P1P_1 ldots\\ldots PN1P_{N - 1}

Output

If it is impossible to sort PP in ascending order with at most 2times1052 \\times 10^5 operations, print -1.

Otherwise, print K+1K + 1 lines to represent a sequence of operations that sorts PP in ascending order, where KK is the number of operations done, as follows:

  • The first line should contain the integer KK;
  • the (1+i)(1 + i)-the line (1leqileqK)(1 \\leq i \\leq K) should contain the integer j (0leqjleqN1)j ~ (0 \\leq j \\leq N - 1) announced in the ii-th operation.

You do not have to minimize the number of operations done. If there are multiple such sequences of at most 2times1052 \\times 10^5 operations, any of them will be accepted.


Sample Input 1

8
7 1 2 6 4 0 5 3

Sample Output 1

4
6
0
3
0

This sequence of operations sorts PP in ascending order, as follows:

  • First, announce i=6i = 6. We swap P6(=5)P_6 (= 5) and P(6+5)textrmmod8=P3(=6)P_{(6 + 5) \\textrm{ mod } 8} = P_3 (= 6), turning PP into 7,1,2,5,4,0,6,37, 1, 2, 5, 4, 0, 6, 3.

  • Then, announce i=0i = 0. We swap P0(=7)P_0 (= 7) and P(0+7)textrmmod8=P7(=3)P_{(0 + 7) \\textrm{ mod } 8} = P_7 (= 3), turning PP into 3,1,2,5,4,0,6,73, 1, 2, 5, 4, 0, 6, 7.

  • Then, announce i=3i = 3. We swap P3(=5)P_3 (= 5) and P(3+5)textrmmod8=P0(=3)P_{(3 + 5) \\textrm{ mod } 8} = P_0 (= 3), turning PP into 5,1,2,3,4,0,6,75, 1, 2, 3, 4, 0, 6, 7.

  • Finally, announce i=0i = 0. We swap P0(=5)P_0 (= 5) and P(0+5)textrmmod8=P5(=0)P_{(0 + 5) \\textrm{ mod } 8} = P_5 (= 0), turning PP into 0,1,2,3,4,5,6,70, 1, 2, 3, 4, 5, 6, 7.