Statement
You are given a permutation . You may perform the following operation any number of times.
- Choose integers with .
- In the subarray , swap the positions containing the smallest and the second-smallest values.
Print the minimum number of operations required to sort the permutation in increasing order and one sequence of operations attaining that minimum.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, first print the minimum number of operations .
Then print lines containing the chosen for each operation in order. If there are multiple optimal sequences, print any of them.
Constraints
- .
- .
- is a permutation of .
- The sum of over all test cases does not exceed .
Subtasks
Samples
The elements in the interval are and . Swapping the positions of the smallest and second-smallest elements in this interval changes the permutation to . Since the original permutation is not sorted, the minimum number of operations is .