N=int(input())
S=list(map(int,input().split()))
ans=0
mod=10**9+7
for i in range(1,61):
   zero,one=0,0
   for j in S:
      tmp=bin(j)[2:]
      tmp=tmp.zfill(60)
      if tmp[-i]=="1":
         one+=1
      else:
         zero+=1
   s=pow(2,i-1,mod)
   ans+=s*zero*one%mod
   ans%=mod
print(ans)