n = int(input())
lst = [int(i) for i in input().split()]
s = 0
x = 0
for i in range(n - 1):
    for j in range(i, n):
        print(lst[i]^lst[j])
        s += lst[i]^lst[j]
mod = 10 ** 9  + 7
print(s)