N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  L[i]='{0:061d}'.format(int(format(L[i],"b")))
print(L)
d=0
for i in range(61):  
  c=0
  for j in range(N):    
    c+=int(L[j][-i-1])    
  d+=(c*(N-c))*2**i  
print(d%(10**9+7))