import itertools

N = int(input())
A_list = list(map(int,input().split()))
sum_xor = 0

for i in itertools.product(A_list, repeat=2):
    a,b = i
    sum_xor += a^b

for m in range(N):
    sum_xor -= A_list[m]^A_list[m]

print(int(sum_xor/2))