Xor of Subset Sums
Time limit1sMemory limit512 MB
Given n integers, find the XOR of the sums of all 2^n subsets.
- Level
Medium7 of 10
- Topics
- Bit manipulation, Combinatorics, Math
- Solved
- No attempts yet
Problem
You are given integers . Let .
For a subset of , define as follows.
That is, adds up over every index that belongs to . The empty subset has sum 0, and itself counts as a subset, so there are values in total.
Let be the bitwise exclusive or of all values.
Compute .
Input
The first line contains ().
The second line contains integers separated by spaces ().
Output
Print on the first line.