P7627 [COCI 2011/2012 #1] X3
Description
Given a sequence $A_1, A_2, ..., A_N$ of length $N$, find the sum of the pairwise XOR of all elements in the sequence.
Input Format
The first line contains a positive integer $N$.
The next $N$ lines each contain a positive integer $A_i$.
Output Format
Output one integer on a single line, representing the sum after taking XOR over all unordered pairs.
Explanation/Hint
#### Sample 2 Explanation
$A_1 ⊕ A_2 = 4$, $A_1 ⊕ A_3 = 2$, $A_2 ⊕ A_3 = 6$, and $4 + 2 + 6 = 12$, so the answer is $12$.
#### Constraints
For $100\%$ of the testdata, $1 \le N \le 10^6$ and $1 \le A_i \le 10^6$.
#### Notes
The score of this problem follows the original COCI setting, with a full score of $110$.
This problem is translated from **[COCI2011-2012](https://hsin.hr/coci/archive/2011_2012/) [CONTEST #1](https://hsin.hr/coci/archive/2011_2012/contest1_tasks.pdf)** ___T3 X3___.
Translated by ChatGPT 5