import itertools

N = int(input())
A_list = list(map(int,input().split()))
sum_xor = []
append = sum_xor.append

for i in itertools.combinations(A_list, 2):
    a,b = i
    append(a^b)

print(sum(sum_xor))