Given an array A of N numbers, find the number of distinct pairs (i, j) such that j ≥i and A[i] = A[j].

First line of the input contains number of test cases T. Each test case has two lines, first line is the number N, followed by a line consisting of N integers which are the elements of array A.

For each test case print the number of distinct pairs.  

Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 10^6 
-10^6 ≤ A[i] ≤ 10^6 for 0 ≤ i < N

SAMPLE INPUT
3
4
1 2 3 4
3
1 2 1
5
1 1 1 1 1

SAMPLE OUTPUT
4
4
15
import collections

input_list =[]
number_of_testcases = raw_input()

def FindDistinctPairs(elements):
    dc=0
    counter=collections.Counter(elements)
    for k in counter.values():
        dc+=Summation(int(k))
    print(int(dc))

def Summation(num):
    sum = (num * (1+num))/2
    return sum

while int(number_of_testcases)!=0:
    input_list.append(int(raw_input()))
    input_list.append(list(raw_input().split()))
    number_of_testcases=int(number_of_testcases)-1

for val in range(0,len(input_list),2):
     if val+1 < len(input_list):
        FindDistinctPairs(input_list[val+1])