n = int(input()) A = list(map(int, input().split())) bit = 1 for a in A: bit ^= bit << a i = 1 ans = 0 bit >>= 1 while bit: if bit & 1: ans ^= i bit >>= 1 i += 1 print(ans)