Rajesh is observing the night sky through his telescope and has calculated the distance of N stars from Earth and arranged the distances in a sequence D. Now, he wants to generate some stats.
He wants to count the number of triplets of stars such that if their indices are x, y and z, following conditions must be satisfied--
1≤x<y<z≤N
Dy−Dx=Dz−Dy
Since, the data set is too big and Rajesh wo't be able to finish it in time, he requires your help.
Input Format:
First line contains T, number of test cases.
First line of each test case contains N, number of stars.
Second line of each test case contains N integers denoting the distance sequence D.
Output Format:
For each test case, output the required answer in separate lines.
Constraints:
1≤T≤10
3≤N≤105
1≤Di≤105
For first case, only triplet which satisfies the above conditions is (1, 2, 3).
For second case, triplets satisfying the conditions are (3, ,4, 5) and (3, 5, 7).