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

ans = 0
mod = int(1e9+7)
for i in range(61):
    tmp = 0
    for j in A:
        tmp += (j>>i)&1
    ans += (N-tmp)*tmp*pow(2,i,mod)

print(ans%mod)