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