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

ans = 0
mod = 1000000007

for i in range(60):
    one_count =0
    zero_count = 0
    for j in range(N):
        if A[j] >> i & 1 == 1:
            one_count+=1
        else:
            zero_count+=1
    ans += (one_count % mod) *(zero_count%mod) * (2**i) % mod
    ans = ans % mod
print(ans)