Bob is a brilliant student in the class, so his teacher assigned him a problem. He has been given an array A containing N positive integers and two integers U and V. He has been asked to find the number of magic pairs of array indices.
A pair of integers (i,j) is called a magic pair if i<j and U≤A[i]^A[j]≤V where ^ denotes the bitwise XOR operation.
Help Bob to find the number of magic pairs in the given array.
Input Format:
Output Format:
For each test case, print the number of magic pairs in the given array.
Constraints:
1≤T≤101≤N≤1040≤A[i]≤1090≤U≤V≤109
For test case 1:
There are 8 magic pairs in the given array:
For test case 2:
Since the array has only one element, there are no magic pairs.