n,*a=map(int,open(0).read().split())
mod=10**9+7
b0=[0 for i in range(60)]
b1=[0 for i in range(60)]
for i in range(n):
  ai=a[i]
  for j in range(60):
    if ai&1==1:
      b1[j]+=1
    else:
      b0[j]+=1
    ai>>=1
ans=0
for i in range(60):
  ans+=(b0[i]*b1[i]*pow(2,i,mod))
  ans%=mod
print(ans)