MOD=10**9+7

N=int(input())
alist=list(map(int,input().split()))

#print(alist)
blist=[0]*64
for a in alist:
  bin_str=format(a, '064b')
  dlist=list(map(int,list(bin_str)))
  #print(bin_str)
  for i in range(64):
    blist[i]+=dlist[i]
      
blist.reverse()
#print(blist)
answer=0
for i in range(64):
  answer+=blist[i]*(N-blist[i])*(2**i)
  
print(answer%MOD)