408028: GYM102964 B Krosh and xor of sums

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Krosh and xor of sumstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Krosh has an array of $$$n$$$ non-negative integers. He determines the beauty of array in the following way. He picks a number $$$1 \le k \le n$$$ and some sequence $$$b$$$ of $$$k$$$ different integers $$$1 \le b_i \le n$$$. Then he determines the value of this sequence $$$V(b)$$$ as sum of elements of an array $$$a$$$ on the corresponding positions from array $$$b$$$: $$$V(b) = \sum \limits_{i = 1}^k a_{b_i}$$$. Then the beauty of an array $$$a$$$ equals to bitwise xor of all the values $$$V(b)$$$ over all possible sequences $$$b$$$ which can be obtained in the way described above(pick $$$k$$$ and $$$k$$$ different numbers from $$$1$$$ to $$$n$$$). Help Krosh to determine the beauty of an array $$$a$$$.

Input

In first line you are given number $$$1 \le n \le 2 * 10^5$$$ – number of elements in array $$$a$$$. In the next line you are given an array $$$a$$$ of $$$n$$$ non-negative integers $$$0 \le a_i \le 10^7$$$.

Output

Output the beauty of an array $$$a$$$.

ExamplesInput
2
1 2
Output
3
Input
1
10
Output
10

加入题单

上一题 下一题 算法标签: