#P1327. 数列排序
数列排序
Description
Given a sequence that satisfies (), you are asked to sort this sequence in ascending order. Each time, you may swap any pair of numbers. What is the minimum number of swaps required?
Input Format
The first line contains an integer , the number of elements.
The second line contains integers separated by spaces, representing the sequence .
Output Format
Output a single line containing one integer, the minimum number of swaps.
8
8 23 4 16 77 -5 53 100
5
Hint
Constraints
For of the testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号