#t266. 求逆序对
求逆序对
Counting Inversions
Problem Background
Special for beginners, ^_^
Problem Description
Given a sequence , if there exist and , we call it an inversion pair. Find the number of inversion pairs in .
Input Format
The first line is , the length of the sequence. The next lines follow, where line gives the -th number in the sequence.
Output Format
The number of inversion pairs in .
Sample Input
4
3
2
3
2
Sample Output
3
Constraints
1s, 1024KiB for each test case.
, .