import numpy as np

N=int(input())
M=10**9+7
A=[int(x) for x in input().split()]
A=np.array(A)

ans=0
for i in range(60):
  #one=sum([a>>i&1 for a in A])
  one=np.sum(A>>i&1)
  zero=N-one
  ans+=(one*zero)*pow(2,i)
  ans%=M
  #print(one,zero)
print(ans)