Bubble Sort - 2#4741

Bubble Sort - 2

1 second
64 megabytes
Very easy

Determine the number of swaps performed by the bubble sort algorithm to sort a given array in ascending order.

Input

The first line contains an integer (1 \leq N \leq 1000), the number of elements in the array. The second line contains integers, the elements of the array. It is guaranteed that all elements are distinct, and their absolute values do not exceed 10^9.

Output

Output a single integer: the total number of swaps performed by the bubble sort algorithm.

Examples

Example 1

Loading
Loading