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