Bubble Sort - 2
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Determine the number of swaps the bubble sort algorithm performs to sort a given array in ascending order.
Input
The first line contains the integer N (1 ≤ N ≤ 1000), representing the number of elements in the array. The second line provides the array itself. It is guaranteed that all elements in the array are distinct and their absolute values do not exceed 10^9.
Output
Output a single integer, which is the total number of swaps performed by the bubble sort.
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 45%