N = int(input())
A = list(map(int, input().split()))
ans = 0
t = []
for i in range(60):
    for j in range(N):
        if A[j] >= 2 ** i:
            t.append((A[j]%(2**(i+1)))//(2**i))
    ans += (t.count(1) * (N-t.count(1))) * 2**i
    t = []
print(ans) 