
def hoge(n):
    return int(n)%(10**9+7)

N = int(input())
A = input().split()

AA = list(map(hoge, A))

xor = 0
for i in range(N-1):
    for j in range(i+1, N):
        xor += AA[i] ^ AA[j]
print(xor)