n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
now = 1

sum = [0 for i in range(60)]
for i in a:
    ii = i
    for j in range(60):
        if ii%2 == 1:
            sum[j] += 1
        ii //= 2
        if ii == 0:
            break

for i in range(60):
    k = (sum[i]*(n-sum[i]))%mod
    ans = (ans+(k*now)%mod)%mod
    now = (now*2)%mod

print(ans)