A workshop has sensors lying on a table, and the -th of them has an id . Two sensors can be linked together only if they are strong together, which the manual defines like this: sensors and form a strong pair when
where denotes the bitwise AND operation and denotes the bitwise XOR operation.
Count how many strong pairs with there are. Two sensors lying at different places on the table are always a different pair, even when they happen to carry the same id.
Input
First line of input will be a single integer - the number of testcases.
Each testcase takes two lines. The first line has a single integer - the number of sensors. The second line has integers - their ids.
Output
For every testcase print a single line with the number of strong pairs.
Example
3 5 1 4 3 7 10 4 6 2 5 3 2 2 4
1 2 0
In the first testcase the only strong pair is , because while . In the third testcase and , so that pair is not strong and the answer is .
Constraints
The sum of over all testcases does not exceed .
This problem was adapted from Rock and Lever, problem B of Codeforces Round 672 (Div. 2).