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