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 = bin(dp) for i in range(1,S+1): if T[-1-i] == "1": ans ^= i print(ans)