n=int(input())
A=list(map(int,input().split()))
l=[0]*60
for a in A:
    a_2=format(a,"060b")
    for i in range(60):
        if a_2[i]=="1":
            l[59-i]+=1
ans=0
k=1
for i in range(60):
    ans=(ans+k*l[i]*(n-l[i]))%1000000007
    k=(k*2)%1000000007
print(ans)