import sys input = sys.stdin.buffer.readline n = int(input()) A = list(map(int, input().split())) temp = 1 for a in A: nx = temp << a # print("temp", bin(temp), "nx", bin(nx)) temp ^= nx # ans = 0 # keta = 0 # while temp: # if temp % 2: # ans ^= keta # temp //= 2 # keta += 1 binary = bin(temp)[2:] ans = 0 for i in range(len(binary)): if binary[len(binary) - i - 1] == "1": ans ^= i print(ans)