Present
시간 제한3초메모리 제한1024 MB
크기가 최대 400,000인 배열에서 모든 쌍의 합 a_i + a_j (i < j)를 구해 전부 XOR한 값을 계산한다.
문제
Catherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. But when she came up with another one --- xor of all pairwise sums of elements in the array, she realized that she couldn't compute it for a very large array, thus she asked for your help. Can you do it? Formally, you need to compute
\begin{align\*} (a\_1 + a\_2) \oplus (a\_1 + a\_3) \oplus \ldots \oplus (a\_1 + a\_n) \oplus \\\ \oplus (a\_2 + a\_3) \oplus \ldots \oplus (a\_2 + a\_n) \oplus \\\ \ldots \\\ \oplus (a\_{n-1} + a\_n) \\\ \end{align\*}
입력
The first line contains a single integer () --- the number of integers in the array.
The second line contains integers ().
출력
Print a single integer --- xor of all pairwise sums of integers in the given array.
힌트
In the first sample case there is only one sum .
In the second sample case there are three sums: , , . In binary they are represented as , thus the answer is 2.
is the bitwise xor operation. To define , consider binary representations of integers and . We put the -th bit of the result to be 1 when exactly one of the -th bits of and is 1. Otherwise, the -th bit of the result is put to be 0. For example, .