N=int(input())
arr=list(map(int,input().split()))
outs=0
MODS=1e9+7
for i in range(60):
  zer=0
  one=0
  ids=0
  for j in range(N):
    if arr[j]%2==0:
      zer+=1
    else:
      one+=1
    arr[j]=int(arr[j]/2)
  ids=int((((one*zer)%MODS)*(1<<i))%MODS)
  outs+=ids
  outs%=MODS
  outs=int(outs)
print(outs)