N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  L[i]='{0:070d}'.format(int(format(L[i],"b")))

d=0
for i in range(63):
  
  c=0
  for j in range(N):
    
    c+=int(L[j][-i-1])
    
  d+=(c*(N-c))*2**i
  
print(d%(10**9+7))