input1 = int(input())
input2 = input().split(" ")
input2loop = enumerate(input2)
for i, value in input2loop:
    input2[i] = int(value)


result = 0
temp = []
for index, i in enumerate(input2):
    temp = input2[index+1:]
    for j in temp:
        result += i ^ j
print(result)
