XOR pair - MarisaOJ: Marisa Online Judge

XOR pair

Time limit: 1000 ms
Memory limit: 256 MB
In the array $A$ consisting of non-negative integers, count the number of pairs $i < j$ such that $A_i \oplus j = A_j \oplus i$, where $\oplus$ denotes the bitwise XOR operation. ### Input - The first line contains an integer $n$. - The second line contains $n$ non-negative integers $A_i$. ### Output - Print an integer representing the number of pairs that satisfy the given condition. ### Constraints - $1 \le n \le 10^5$. - $1 \le A_i \le 10^9$. ### Example Input: ``` 5 7 8 9 14 3 ``` Output: ``` 4 ```