n=int(input())
A=list(map(int,input().split()))
cnt=[[0]*60 for i in range(2)]
for a in A:
    for i in range(60):
        if(a&(1<<i)):
            cnt[1][i]+=1
        else:
            cnt[0][i]+=1
res=0
for i in range(60):
    x = pow(2,i)
    x%=1000000007
    res+=cnt[1][i]*cnt[0][i]*x
    res%=1000000007
print(res)