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