P1327 Sequence Sorting
Description
Given a sequence $a$ that satisfies $a_i \not =a_j$ ($i\not=j$), 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 $n$, the number of elements.
The second line contains $n$ integers separated by spaces, representing the sequence $a$.
Output Format
Output a single line containing one integer, the minimum number of swaps.
Explanation/Hint
#### Constraints
For $100\%$ of the testdata, it is guaranteed that $1\le n\le10^5$, $-2^{31}\lt a_i\lt2^{31}-1$.
Translated by ChatGPT 5