def pos(x, n, m):
    if n == 0:
        return 1
    res = pos(x*x%m, n//2, m)
    if n%2 == 1:
        res = res*x%m
    return res

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

MOD=10**9+7

ans=0
for i in range(60):
    count1=0
    count0=0
    for j in range(N):
        if A[j]>>i & 1:
            count1+=1
        else:
            count0+=1
    ans+=count0*count1%MOD*pos(2,i,MOD)
    ans%=MOD
print(ans)