N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
bi=[0]*60
for i in range(N):
  a=list(map(int,bin(A[i])[2:].zfill(60)))
  for j in range(60):
    bi[j]+=a[j]
  
bi.reverse()
ans=0
for i in range(60):
  ans=(ans+((2**i)*bi[i]*(N-bi[i]))%mod)%mod
  
print(ans)