N=int(input())
A=list(map(int,input().split()))
bin_A=[bin(c) for c in A]
flags=[True]*N

count=0
for keta in range(60):
   count_0=0
   count_1=0
   for i in range(N):
      if flags[i]:
         if bin_A[i][-1*(keta+1)]=="b":
            count_0+=1
            flags[i]=False
         elif bin_A[i][-1*(keta+1)]=="0":
            count_0+=1
         else:
            count_1+=1
      elif flags[i]==False:
         count_0+=1
   count+=count_0*count_1*2**keta

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