def sumXOR(arr, n):       
    MOD = 10 ** 9 + 7
    sum = 0
    for i in range(0, 61): 
        zc = 0
        oc = 0
        idsum = 0
        for j in range(0, n): 
            if (arr[j] % 2 == 0): 
                zc = zc + 1                  
            else: 
                oc = oc + 1
            arr[j] = arr[j] // 2 
          
        idsum = oc * zc * (1 << i)    
        sum = (sum + idsum) % MOD;        
    return sum

n = int(input())
A = list(map(int, input().split()))
sum = 0
sum = sumXOR(A, n); 
print(sum) 
