n = int(input()) A = list(map(int, input().split())) N = max(A)*n+1 dp = 1 for a in A: dp ^= dp<<a ans = 0 b = bin(dp) l = len(b) for i in range(2, l): if b[i] == '1': ans ^= i-2 print(ans)