n=int(input())
a=list(map(int,input().split()))
b=[0]*64
for i in range(n):
    c=bin(a[i])
    for j in range(len(bin(a[i]))-2):
        if c[-j-1]=='1':
            b[j]+=1
c=0
for i in range(64):
    c+=(b[i]*(n-b[i])*2**i)%(10**9+7)
    c %= (10**9+7)
print(c%(10**9+7))
