You are given a permutation. In one step, you can swap any two adjacent elements if their values differ by more than one.
Consider all permutations that can be obtained using these operations, starting from a given permutation. Define a distance between two permutations as the minimum number of these operations required to transform the first permutation into the second one.
Find the number of permutations that can be obtained and the sum of distances to all those permutations from the starting one.
The first line contains the integer $$$n$$$ ($$$1 \le n \le 100$$$) — the permutation size. The second line contains $$$n$$$ distinct integers $$$a_i$$$ ($$$1 \le a_i \le n$$$) — the starting permutation.
Output two integers, the number of obtainable permutations, and the sum of distances to those permutations. Calculate both numbers modulo $$$1\,000\,000\,007$$$.
| Subtask | Points | Constraints |
| 1 | 15 | $$$n \le 8$$$ |
| 2 | 20 | $$$n \le 15$$$ |
| 3 | 30 | $$$n \le 30$$$ |
| 4 | 20 | $$$n \le 50$$$ |
| 5 | 15 | No additional constraints |
4 3 1 4 2
5 5
5 1 2 3 4 5
1 0
6 5 3 1 2 4 6
61 218
In the first example, you can obtain the following permutations:
There are five permutations in total; the sum of distances also equals five.
In the second example, you can't perform any swap, so only one permutation is reachable with a distance of 0.