N = int(input())
A = list(map(int, input().split()))
M = 61
ans = 0
mod = 10**9+7
for i in range(M):
    b = 1<<i
    cnt = 0
    for a in A:
        if (a>>i)&1:
            cnt+=1
    ans+=b*(N-cnt)*cnt
    ans%=mod
print(ans)

