Given a permutation of the first positive integers and the ability to swap any two adjacent integers, compute the minimum number of swaps needed to sort the list in decreasing order.
form a permutation of the first positive integers.
The first line of the input consists of a single integer, .
The next line contains space-separated integers, the permutation of the first integers.
Output, on a single line, the minimum number of swaps needed.
3 2 1 3