Xor of Subset Sums

Given n integers, find the XOR of the sums of all 2^n subsets.

Medium7Bit manipulationCombinatoricsMathNo attempts yetTime limit1sMemory limit512 MB

Problem

You are given nn integers A1,A2,,AnA_1, A_2, \dots, A_n. Let N={1,2,,n}N = \{1, 2, \dots, n\}.

For a subset II of NN, define SIS_I as follows.

SI=kIAkS_I = \sum_{k \in I} A_k

That is, SIS_I adds up AkA_k over every index kk that belongs to II. The empty subset has sum 0, and NN itself counts as a subset, so there are 2n2^n values SIS_I in total.

Let XX be the bitwise exclusive or of all 2n2^n values.

X=INSIX = \bigoplus_{I \subseteq N} S_I

Compute XX.

Input

The first line contains nn (1n301 \le n \le 30).

The second line contains nn integers A1,A2,,AnA_1, A_2, \dots, A_n separated by spaces (0Ai<2300 \le A_i < 2^{30}).

Output

Print XX on the first line.