N = int(input())
A = list(map(int,input().split()))
S = [0 for i in range(60)]
for i in range(N):
    a = A[i]
    for j in range(60):
        if (a>>j)&1:
            S[j] += 1
mod = 10**9 + 7
ans = 0
for i in range(60):
    s = S[i]
    t = N - s
    r = (s*t*(2**i))%mod
    ans = (ans + r)%mod
print(ans)