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

b = [format(x,'b').zfill(60) for x in a]
b = [list(reversed(x)) for x in b]


ones = [0 for i in range(60)]
for x in b:
    for i in range(60):
        if x[i]=='1':
            ones[i] += 1

pow_two = [pow(2,i,mod) for i in range(60)]

ans = 0
for x in b:
    for i in range(60):
        if x[i]=='0':
            ans += ones[i]*pow_two[i]
        else:
            ans += (n-ones[i])*pow_two[i]
    ans %= mod

print(ans//2)