Shubham and Xor

3.6

49 votes
Algorithms, Bubble sort algorithm, Easy, Searching, Sorting
Problem

You are given an array of n integer numbers a1, a2, .. ,an. Calculate the number of pair of indices (i,j) such that 1i < jn and ai xor aj=0

Input format
- First line: n denoting the number of array elements
- Second line: n space separated integers a1, a2, .. ,an.

Output format
Output the required number of pairs.

Constraints
1n106
1ai109

Sample Input
5
1 3 1 4 3
Sample Output
2
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The 2 pair of indices are (1,3) and (2,5) .

Editor Image

?