N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

table = [0] * 60

for a in A:
    for i in range(60):
        if (a>>i) & 1:
            table[i] += 1

ans = 0
for i ,t in enumerate(table):
    ans += t * (N-t) * 2**i
    ans %= MOD
print(ans)