EasyRating 1000
Out of Order Pairs
Count pairs i < j with a[i] > a[j]. n ≤ 2000.
Input
n, then n integers.
Output
A count.
Sample 1
Input
5 2 4 1 3 5
Output
3
Sample 2
Input
3 1 2 3
Output
0
Output appears heren, then n integers.
A count.
5 2 4 1 3 5
3
3 1 2 3
0
Output appears here