N = int(input())
A = list(map(int,input().split()))

num = 0

def Base_n_to_10(X,n):
    out = 0
    for i in range(1,len(str(X)+1)):
        out += int(X[-i])*(n**(i-1))
    return out


for i in range(N-1):
    for j in range(i+1,N):
        b3 = A[i]^A[j]
        num += b3

print(num)