#AGC058A. [AGC058A] Make it Zigzag

[AGC058A] Make it Zigzag

Score : 400400 points

Problem Statement

You are given a permutation P=(P1,P2,,P2N)P=(P_1,P_2,\cdots,P_{2N}) of (1,2,,2N)(1,2,\cdots,2N).

The following operation may be performed between 00 and NN times (inclusive).

  • Choose an integer xx (1x2N11 \leq x \leq 2N-1). Swap the values of PxP_x and Px+1P_{x+1}.

Present a sequence of operations that make PP satisfy the following conditions.

  • PiforeachP_i for each i=1,3,5,\cdots,2N-1$;
  • Pi>Pi+1P_i>P_{i+1} for each i=2,4,6,,2N2i=2,4,6,\cdots,2N-2.

It can be proved that such a sequence of operations always exists.

Constraints

  • 1N1051 \leq N \leq 10^5
  • (P1,P2,,P2N)(P_1,P_2,\cdots,P_{2N}) is a permutation of (1,2,,2N)(1,2,\cdots,{2N}).
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

P1P_1 P2P_2 \cdots P2NP_{2N}

Output

Print a desired sequence of operations in the following format:

KK

x1x_1 x2x_2 \cdots xKx_K

Here, KK is the number of operations performed (0KN0 \leq K \leq N), and xix_i is the value of xx chosen in the ii-th operation (1xi2N11 \leq x_i \leq 2N-1). If there are multiple solutions satisfying the condition, printing any of them will be accepted.

2
4 3 2 1
2
1 3

These operations make P=(3,4,1,2)P=(3,4,1,2), which satisfies the conditions.

1
1 2
0