Bubble Sort#177

Bubble Sort

1 second
64 megabytes
Easy (≈1000)

Determine the number of swaps that will occur during a bubble sort for sorting a given array in ascending order.

Input

The first line contains the integer (1 ≤ n ≤ 1000), which represents the number of elements in the array. The second line contains the array itself. It is guaranteed that all elements of the array are distinct and do not exceed 10^9 in absolute value.

Output

Output a single integer representing the number of swaps that occur during the bubble sort.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading