You are given a permutation of number (I.E. each number occurs exactly once). Now you want to introduce some chaos to this permutation. To introduce chaos, you can perform at most swaps between adjacent positions. The chaosness of the final permutation is calculated as the count of the mismatches I.E. the number of indices such that (the indices are 1-indexed). Output the maximum number of mismatch you can make and also output such a sequence of swaps.
There will be testcases.
Each testcase begins with a line containing space separated numbers , . Next line contains space separated numbers representing the initial permutation.
sum of over all testcases
For each testcase first output one number in a line, is the number of swaps you will perform. In the next lines, output the swaps to be performed. To swap positions and output the numbers and . Note that the swaps you perform should be between adjacent positions.
In case of multiple answer, you can output any.
2 4 2 1 4 2 3 10 2 1 2 3 4 5 6 7 8 9 10
1 1 2 2 1 2 9 10