#coding:utf-8
N = int(input())
A = list(map(int,input().split()))
sm = 0
MOD = 1000000007
def sumXOR(arr,  n):       
    sum = 0
    for i in range(0, 64): 
        #  Count of zeros and ones 
        zc = 0
        oc = 0
           
        # Individual sum at each bit position 
        idsum = 0
        for j in range(0, n): 
            if (arr[j] % 2 == 0): 
                zc = (zc + 1)%MOD
                  
            else: 
                oc = (oc + 1)%MOD
            arr[j] = int(arr[j] / 2) 
          
           
        # calculating individual bit sum  
        idsum = (oc * zc * (1 << i) ) % MOD
   
        # final sum     
        sum = (sum + idsum)%MOD;  
      
    return sum % MOD

sm = sumXOR(A,N)
print (sm)

