You are given an array A having N integers. Find the number of triplets (i,j,k) such that
The median of three integers is the middle element after sorting the three integers. For example, the median of (5,1,3) is 3, (2,4,4) is 4.
Input format
Output format
For each test case, print the number of triplets that satisfies the given conditions in a separate line.
Constraints
1≤T≤1051≤N≤1051≤Ai≤NSum of N over all test cases does not exceed 3⋅105.
In the first test case, there are 2 tuples that satisfy the given conditions:
(2,4,5): The median of (A2,A4,A5)=(5,5,4) is 5 which is equal to A4.