n=int(input())
a=list(map(int,input().split()))

cnt=[0]*100
p=10**9+7
for m in a:
    #print(m)
    kei=m
    for i in range(100):
        cnt[i]+=kei%2
        kei//=2
        if(kei==0):
            break

#print(cnt)

lis=[]
jou=1
for i in range(100):
    lis.append(jou)
    jou*=2
    jou%=p

ans=0

for i in range(100):
    ans+=(lis[i]%p)*(cnt[i]%p)*((n-cnt[i])%p)
    ans%=p

print(ans)