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

mod = 10**9 + 7
ans = 0

for d in range(60):
    n0, n1 = 0, 0
    for i in range(N):
        if (A[i] >> d) & 1:
            n1 += 1
        else:
            n0 += 1
    ans = (ans + (n0 * n1) * (1 << d))% mod
    
print(ans)