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

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

ones = [0 for i in range(60)]
for x in b:
    for i in range(60):
        if x[59-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[59-i]=='0':
            ans += ones[i]*pow_two[i]
        else:
            ans += (n-ones[i])*pow_two[i]


print((ans//2)%mod)