import numpy as np n = int(input()) A = list(map(int, input().split())) DP = np.zeros(4000005, np.bool_) DP[0] = 1 for i in range(n): DP[A[i]:] ^= DP[:-A[i]] ans = 0 for i in range(1, 4000001): if DP[i]: ans ^= i print(ans)