n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7

mm0 = [0 for i in range(60)]
mm1 = [0 for i in range(60)]

for i in range(n):
    for j in range(60):
        if (a[i]>>j)<0:
            break
        if (a[i]>>j)&1:
            mm1[j] += 1

ans = 0
for i in range(60):
    ttl = (n-mm1[i])*mm1[i]
    ans += ((1<<i)*ttl)%mod
    ans %= mod

print(ans)
