N=int(input())
A=[int(x) for x in input().split()]
S=[0]*60

for i,a in enumerate(A):
  c=0
  while a>0:
    if a&1!=0:
      S[c]+=1
    a>>=1
    c+=1

s,c=0,0
while c<60:
  s+=S[c]*(N-S[c])*((2**c)%(10**9+7))
  c+=1

print(s%(10**9+7))
