N = int(input()) A = list(map(int, input().split())) now = 1 for a in A: now = (now << a) ^ now ans = 0 for i in range(sum(A) + 1): if (now >> i) & 1: ans ^= i print(ans)