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) ^ dp S += a ans = 0 mask = 1 for i in range(1,S+1): mask <<= 1 if dp & mask: ans ^= i print(ans)