import itertools

n=int(input())
nums=list(map(int, input().split()))

c = itertools.combinations(nums, 2)
loopnum=len(list(c))
c = itertools.combinations(nums, 2)
sum = 0
for i in range(loopnum):
  temp = next(c)
  sum += temp[0]^temp[1]
print(sum)
  