#K91917. Counting Magical Pairs

    ID: 38082 Type: Default 1000ms 256MiB

Counting Magical Pairs

Counting Magical Pairs

You are given several test cases. In each test case, you are provided with an integer N representing the number of stones, followed by N integers denoting the power levels of the stones. Your task is to determine the number of magical pairs such that for any two stones with indices i and j (with i < j), the condition
$$a_i < a_j$$
holds.

Calculate and output the total number of magical pairs for each test case. Each result should be printed on a new line.

inputFormat

The input begins with an integer T indicating the number of test cases. Each test case is described in a single line starting with an integer N (the number of stones), followed by N space-separated integers representing the power levels of the stones.

outputFormat

For each test case, output a single integer on its own line representing the number of magical pairs.

## sample
2
5 1 2 3 4 5
4 4 3 2 1
10

0

</p>