Given an array of positive integers. Find the number of ordered pairs (i, j) such that A[i] = A[j] and there does not exist any element between i and j whose value is greater than A[i].
First line of input contains number of testcases T. For each testcase T, first line contains the number of elements N in the array and the second line contains N space separated integers.
For each test, output the required number of pairs.
1 ≤ T ≤ 10
1 ≤ N ≤ 105
1 ≤ Ai ≤ 103
4 3 1 3 4 4