LearnPy Hub
← Arena
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
solution.py
Output appears here
Out of Order Pairs · Python Arena problem · LearnPy Hub