LearnPy Hub
← Arena
AdvancedRating 1500

Sum of Subset XORs

Print the sum, over every subset of the array, of the XOR of its elements (the empty subset counts as 0).

Input

n, then n integers.

Output

A number.

Sample 1

Input
2
1 3
Output
6

Sample 2

Input
3
5 1 6
Output
28
solution.py
Output appears here
Sum of Subset XORs · Python Arena problem · LearnPy Hub