


For the array [50, 21, 9], if we follow 1-based indexing, the Reverse Pairs are (1, 2), (1, 3) and (2, 3). Thus, the total count i.e. the answer becomes 3.
A single index of the pair (i, j) can be used multiple times.
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of every test case contains an integer ‘N’ denoting the size of the array/list.
The second line of every test case contains ‘N’ space-separated integers denoting the elements of array/list 'ARR'.
For each test case, print the number of distinct pairs.
The output of each test case will be printed in a separate line.
You don’t have to print anything, it has already been taken care of. Just implement the function.
1 <= T <= 5
2 <= N <= 3000
1 <= ARR[i] <= 10^5
Where 'ARR[i]' denotes the i-th elements in the array/list.
Time Limit: 1 sec
The pictorial representation for Conquer algorithm is:
Thus, the answer is 3 and indices pairs are (2, 4), (1, 3) and (1, 4).