| SDU Open 2023 |
|---|
| Finished |
A permutation of length $$$n$$$ is a sequence of all integers from $$$1$$$ to $$$n$$$ inclusive, arranged in a certain order. In other words, it is a one-to-one mapping of numbers from $$$1$$$ to $$$n$$$ onto themselves.
You have a permutation $$$p$$$ of length $$$n$$$, sorted in decreasing order. You want to sort this permutation in increasing order. To do this, you can perform the following operation:
For example, if $$$p = (2, 3, 1, 4, 5, 7, 6)$$$ and you perform the operation with the pair $$$s = 2$$$ and $$$k=2$$$, you will get the permutation $$$p = (2, 4, 5, 3, 1, 7, 6)$$$ by swapping the consecutive blocks $$$(3, 1)$$$ and $$$(4, 5)$$$ of length $$$2$$$.
Sort $$$p$$$ in increasing order using no more than $$$n$$$ operations.
The first line of the input file contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$).
In the first line, output a single integer $$$m$$$ ($$$0 \le m \le n$$$) — the number of operations you performed.
In the next $$$m$$$ lines, output pairs $$$(s_i, k_i)$$$ — all the operations you performed in the order they were performed.
6
4 1 3 1 2 2 2 3 2
2
1 1 1
Explanation for the first example:
| Name |
|---|


