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

cnt=[0]*100

for m in a:
    #print(m)
    kei=m
    for i in range(100):
        cnt[i]+=kei%2
        kei//=2

#print(cnt)

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

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

print(ans)