Given a permutation of the first ~N~ 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.
~1 \le N \le 10^3~
~v_i~ form a permutation of the first ~N~ positive integers.
The first line of the input consists of a single integer, ~N~.
The next line contains ~N~ space-separated integers, the permutation of the first ~N~ integers.
Output, on a single line, the minimum number of swaps needed.
3 2 1 3