Wesley got an array of
Unfortunately, Wesley quickly realized that it might not be possible to sort the array. He then wonders: what is the minimum value of
For this problem, Python users are recommended to use PyPy over CPython.
Constraints
For this problem, you will be required to pass all the samples in order to receive points. In addition, you must pass all previous subtasks to earn points for a specific subtask.
For all subtasks:
Subtask 1 [18%]
Subtask 2 [82%]
No additional constraints.
Input Specification
The first line will contain
The next line will contain
Output Specification
This problem is graded with an identical
checker. This includes whitespace characters. Ensure that every line of output is terminated with a \n
character and that there are no trailing spaces.
Output the minimum value of 0
.
Sample Input
8
1 4 4 2 7 14 12 10
Sample Output
2
Sample Explanation
If we swap the second and fourth element, we obtain:
1 2 4 4 7 14 12 10
Now we can swap
1 2 4 4 7 12 14 10
1 2 4 4 7 10 14 12
And finally,
1 2 4 4 7 10 12 14
It can be proven that this is the smallest possible
Comments