##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
| # | Title | Points | Solved | Admin | |
|---|---|---|---|---|---|
You are given a permutation of the integers from to .
In one operation, you may do the following:
Find the number of distinct permutations that can be reached after performing any number of operations, possibly zero.
Print the answer modulo .
No operation can be performed, so the only reachable permutation is .
Starting from , the following sequences of chosen indices produce all reachable permutations:
Therefore, the answer is .
Starting from , choosing the indices
produces the six distinct reachable permutations. Therefore, the answer is .
For example, choosing the indices produces . Considering all legal sequences gives distinct reachable permutations.
For example, applying the operation at index nine times produces . Considering all legal sequences gives distinct reachable permutations.