import numpy as np
n,*a=map(int,open(0).read().split())
mod=10**9+7
a=np.array(a)
b0=np.array([0 for i in range(60)])
b1=np.array([0 for i in range(60)])
for i in range(60):
  c=len(a[a&1==1])
  b1[i]=c
  b0[i]=n-c
  a>>=1
ans=0
for i in range(60):
  ans+=(b0[i]*b1[i]*pow(2,i,mod))
  ans%=mod
print(ans)