n = int(input()) A = list(map(int, input().split())) N = max(A)*n+1 dp = 1 for a in A: dp ^= dp<>i)&1: ans ^= i print(ans)