You're given an array of size , you must find the number of majestic ranges (l,r) (1 \le l \le r \le n).
A range (l,r) is considered majestic if and only if the bitwise AND of all the elements in the range equals the length of the range, i.e.
must hold.
The first line of the input contains an integer (1 \le t \le 2 \cdot 10^5) — the number of testcases.
The description for the test cases follows.
The first line of each test case contains a single integer (1 \le n \le 2 \cdot 10^5) — the size of the array .
The second line of each test case contains integers a_1 , a_2 , ... , a_n (0 \le a_i \le 10^9) — the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed 2 \cdot 10^5.
For each test case output a single integer, the number of majestic ranges.
Example 1
In the first test case, the majestic segments are:
: a_1=1 and its length is and its bitwise is as well so it's majestic.
: a_2 \ \& \ a_3=2 \ \& \ 3=2 and the length is so it's majestic.
In the second test case, the majestic segments are:
: a_1 \ \& \ a_2 \ \& \ a_3 \ \& \ a_4=4 \ \& \ 12 \ \& \ 6 \ \& \ 5=4 and the length is so it's majestic.
: a_5=1 and its length is and its bitwise is as well so it's majestic.
Subtask ( points): (\sum n \le 1000)
Subtask ( points): (a_i=a_j) for all (1 \le i,j \le n)
Subtask ( points): No additional constraints