int(input())
lis = list(int(i) for i in input().split())  
sum = 0
for i in range(len(lis)):
  for j in range(len(lis)):
    if i != j:
	    sum += lis[i] ^ lis[j]
        
#print(int(sum/2) % (1000000000 + 7))