You are given an array $$$a_1, a_2, \ldots, a_n$$$. Find the number of tuples ($$$x, y, z$$$) such that:
We define $$$f(l, r) = a_l \oplus a_{l + 1} \oplus \ldots \oplus a_{r}$$$, where $$$\oplus$$$ denotes the bitwise XOR operation.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$).
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output a single integer on a new line — the number of described tuples.
336 2 41357 3 7 2 1
4 0 16
In the first case, there are 4 such tuples in the array $$$[6, 2, 4]$$$:
In the second test case, there are no such tuples.
Name |
---|