#2612. 求逆序对

求逆序对

Description

给定一个序列$a\_1,a\_2,…,a\_n$,如果存在$ia\_j$,那么我们称之为逆序对,求逆序对的数目。

Input Format

第一行为$n$,表示序列长度,接下来的$n$行,第$i+1$行表示序列中的第$i$个数。

Output Format

所有逆序对总数。

4
3
2
3
2

3

Hint

N105A_i105N≤10^5,A\_i≤10^5