n = int(input())
a = list(map(int,input().split()))
x = [0 for i in range(62)]
for i in range(n):
    b = bin(a[i])
    for i in range(len(b)-2):
        x[-i-1] += int(b[-i-1])
mod = 10**9+7
ans = 0
two = 1
for i in range(1,62):
    ans = (ans + x[-i]*(n-x[-i])*two)%mod
    two = two*2%mod
print(ans)
