 Timer is Running

Pairs with given XOR
##### Submissions: 1976   Accuracy: 32.69%   Difficulty: Basic   Marks: 1

Given an array of distinct +ve integers A[] and a number x, your task is to find the number of pairs of integers in the array whose XOR is equal to x.
Examples:

```Input : A[] = {5, 4, 10, 15, 7, 6}, x = 5
Output : 1
Explanation :  (10 ^ 15) = 5

Input : A[] = {3, 6, 8, 10, 15, 50}, x = 5
Output : 2
Explanation : (3 ^ 6) = 5 and (10 ^ 15) = 5 ```

Input:
The first line of input contains an integer T denoting the no of test cases . Then T test cases follow. Each test case contains 3 lines . The first line of each test case is an integer N denoting the size of the array A. In the next line are N space separated values of the array A. In the next line is an integer x.

Output:
For each test case output in a new line  the number of pairs of integers in the array whose XOR is equal to x.

Constraints:
1<=T<100
1<=N<=100
1<=A[] <=1000

Example:
Input:

2
6
3  6 8 10 15 50
5
6
5 4 10 15 7 6
5

Output:
2
1

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Joshi 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.