#T256. 求逆序对
求逆序对
Description
Given a sequence , if there exists and , then this pair is called an inversion. The task is to count the total number of inversions in the sequence.
Input Format
The first line contains , representing the length of the sequence. The following lines each contain one element of the sequence, where the -th line corresponds to the -th element of the sequence.
Output Format
The total number of inversions in the sequence.
4
3
2
3
2
3
Hint
.