n = int(input())
a = list(map(int, input().split()))
ans = 0
MOD = 10**9 + 7
for i in range(60):
    tmp0 = 0
    tmp1 = 0
    for j in range(n):
        if a[j]>>i&1 == 0: tmp0 += 1
        else: tmp1 += 1
    ans += (tmp0*tmp1%MOD)*(2**i%MOD)
print(ans%MOD)