SP6256 INVCNT - Inversion Count

Description

Let A\[0...n - 1\] be an array of n distinct positive integers. If i < j and A\[i\] > A\[j\] then the pair (i, j) is called an inversion of A. Given n and an array A your task is to find the number of inversions of A.

Input Format

The first line contains t, the number of testcases followed by a blank space. Each of the t tests start with a number n (n

Output Format

For every test output one line giving the number of inversions of A.