In this problem, a permutation of elements is defined as a sequence of integers of length , where each number from to n-1 appears exactly once. Let the -th element of the permutation be denoted as p_i, where is an index from to n-1. The product of two permutations and of elements is another permutation of elements, such that c_i = a_{b_i}. Note that permutation multiplication is left-associative, meaning operations are performed from left to right.
Among permutations, we focus on double permutations. A double permutation can be represented as a union of two non-overlapping increasing sequences. For example, the permutation (1, 3, 4, 0, 5, 2) is a double permutation because it can be split into two increasing sequences: (1, 3, 4, 5) and . In contrast, the permutation (5, 1, 3, 4, 0, 2) is not a double permutation.
Your task is to write a program that decomposes a given permutation into a product of double permutations. The number of double permutations in the product should be as small as possible. Your program should find a solution consisting of no more than double permutations.
The first line contains the number (2 \leq n \leq 20000).
The second line contains numbers that define the initial permutation.
If a solution cannot be found under the given constraints, output the single number .
If a solution exists, output the number — the number of double permutations in the found solution, on the first line, and in the following lines, output the double permutations themselves in the order they appear in the product.
Example 1