N = int(input())
As = [int(i) for i in input().split(" ")]
 
total = 0
for k in range(Nmax):
    
    #counter = [0,0]
    o = 0
    z = 0
    
    for i in range(N):
        
        # k桁を取り出す
        ai_k = As[i] >> k & 1
        
        # 0と1の個数を数える
        #counter[ai_k] += 1
        if ai_k == 0:
            o += 1
        else:
            z += 1
        
    total += (2**k)*o*z #counter[0]*counter[1]
    
print(total%int(1e9+7))