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
from collections import Counter
 
num_tc = input()
 
arrays = []
for i in range(num_tc):
    some_input = input()
    useful_input = raw_input()
    numbers = useful_input.split()
    arrays.append(numbers)
 
 
composite_array = arrays
 
 
counter_array=[]
for some_array in composite_array :
    counter_array.append(Counter(some_array))
 
 
for one_array in counter_array:
    temp_result = 0
    for j in one_array:
        k = one_array[j]
        temp_result += (k*(k+1))/2
    print temp_result