n = int(input())
a = list(map(int,input().split()))
tmp = [0]*61
MOD = 1_000_000_007
for i in range(n):
    for j in range(61):
        mask = 1<<j
        if a[i]&mask>0:
            tmp[j]+=1
ans = 0
for i in range(61):
    mask = 1<<i
    ans = (ans + mask*tmp[i]*(n-tmp[i])) % MOD
print(ans)