A rack holds n items with distinct integer labels in some order. In one move you may swap any two items (not necessarily adjacent). Report the minimum number of swaps needed to arrange the labels in strictly ascending order.
Input format
Line 1: an integer n.
Line 2: n space-separated distinct integers, the labels in their current order.
Output format
A single integer: the minimum number of swaps to sort the labels ascending.
Constraints
- 1 ≤ n ≤ 100000
- labels are distinct and fit in a 32-bit signed integer.