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

for i in range(61):
    b = 1<<i
    count = 0
    for a in A:
        c = a & b
        if c != 0:
            count += 1
    ans += b*count*(N-count)

print(ans%M)
