n = int(input())
a = list(map(int, input().split()))
cnt = [0] * 60
mod = 1000000007
ans = 0
for i in range(n):
    b = format(a[i],'b')
    for j in range(len(b)):
        cnt[j] += int(b[-j-1])
for i in range(60):
    ans += (pow(2,i,mod)*(cnt[i]*(n-cnt[i])%mod))%mod
    ans %= mod
print(ans)
