
MOD = 10 ** 9 + 7
n = int(input())
a = list(map(lambda x: format(int(x), '060b')[::-1], input().split()))

ans = 0
onecount = [0 for i in range(60)]
zerocount = [0 for i in range(60)]
for i in range(n):
    for j in range(60):
        if a[i][j] == '1':
            onecount[j] += 1
        else:
            zerocount[j] += 1

for i in range(60):
    ans += (2 ** i) * onecount[i] * zerocount[i]
print(ans)
