n=int(input())
a=list(map(int,input().split()))
dig=1
ans=0
m=max(a)
k=0
mod=10**9+7
while m>>k >0:
    k+=1
k=max(0,k)
for j in range(k):
    cnt=0
    for i in range(n):
        if a[i]>>j & 1:
            cnt+=1
    cnt=cnt*(n-cnt)%mod
    ans=(ans+dig*cnt%mod)%mod
    dig=dig*2%mod
print(ans)