Given an array. Write a program to calculate the sum of lengths of contiguous subarrays having all distinct elements.

Input:
First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a single integer N which denotes the number of elements in the array. Second line of each test case contains N space separated integers. Output:
For each test case, print the sum of lengths of contiguous subarrays having all distinct elements.