#P11651. XOR Sum of Pair Sums
XOR Sum of Pair Sums
XOR Sum of Pair Sums
Given a sequence of non-negative integers \(a_1, a_2, \ldots, a_n\) of length \(n\), compute the value of \( \bigoplus_{1 \le i \le j \le n} (a_i + a_j)\), where \(\oplus\) represents the bitwise XOR operation.
Note that when \(i = j\), the term becomes \(2a_i\). All pairs \((i, j)\) with \(1 \le i \le j \le n\) are considered in the computation.
inputFormat
The input consists of two lines:
- The first line contains a single integer \(n\), representing the length of the sequence.
- The second line contains \(n\) non-negative integers \(a_1, a_2, \ldots, a_n\), separated by spaces.
outputFormat
Output a single integer which is the result of \(\bigoplus_{1 \le i \le j \le n} (a_i + a_j)\).
sample
3
1 2 3
2
</p>