n = int(input())
l = list(map(int,input().split()))
c1 = [0]*70
c0 = [0]*70
mod = 10**9+7

for i in l:
    for j in range(60):
        if (i >> j) & 1:
            c1[j] += 1
        else:
            c0[j] += 1

ans = 0
ni = 1
for i in range(70):
    ans += (c1[i]*c0[i]*ni)%mod
    ans %= mod
    ni = ni*2%mod
print(ans%mod)
