Problems
Bubble sort
Bubble sort
Determine how many exchange operations are done in bubble sort algorithm to sort the elements of array in ascending order.
Input data
The first line contains the number of elements n (1 ≤ n ≤ 1000) in array. The second line contains the array itself. It is guaranteed that all array elements are different and do not exceed 10^9
by absolute value.
Output data
Print the number of swaps in bubble sort.
Examples
Input example #1
3 1 3 2
Output example #1
1
Input example #2
2 2 1
Output example #2
1
Input example #3
4 4 1 5 3
Output example #3
3