Bubble sort#2663

Bubble sort

1 second
64 megabytes
Easy

Determine how many swaps the bubble sort algorithm performs to sort the given array in ascending order.

Input

The first line contains the number of elements (1 \le n \le 1000) in the array.

The second line contains the array itself.

It is guaranteed that all array elements are distinct and that their absolute values do not exceed 10^9.

Output

Print one integer — the number of swaps performed by bubble sort.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading