A permutation of length is given.
In one rearrangement, choose exactly distinct positions. You may arbitrarily rearrange only the values currently placed at the chosen positions. Values at unchosen positions do not change.
Your goal is to sort the permutation so that for every .
Find the minimum possible number of rearrangements.
The input is given from Standard Input in the following format:
For each test case, print the minimum possible number of rearrangements on one line.
The minimum numbers of rearrangements for the four test cases are , respectively.
Each case is given in the following format:
| 3 | 30 | in every test case. |
| 4 | 40 | No additional constraints. |