import sys rr = sys.stdin N = int(rr.readline()) A = list(map(int,rr.readline().split())) dp = 1 S = 0 for a in A: dp ^= (dp << a) S += a ans = 0 mask = 1 T = list(map(int,list(bin(dp)[2:]))) for i in range(1,S+1): if T[-1-i]: ans ^= i print(ans)