N=int(input())
A=list(map(int,input().split()))
 
def jouyo(X):
    return X%1000000007
 
MAX=A[0]
for i in range(N):
    if MAX<=A[i]:
        MAX = A[i]
    else:
        MAX = MAX
 
p = 1
M = 1
for i in range(60):
    if 2*p <= MAX:
        p = 2*p
        M = M+1
    else:
        break
        
e=[]
for i in range(M+1):
  	e.append(2**i)
 
List = []        
for i in range(1,M+1):
    count = 0
    for j in range(N):
        if A[j]%e[i] >= e[i-1]:
            count = count +1
        else:
            count = count
    List.append(count)
    
ans = 0   
for i in range(M):
    ans = jouyo(ans) + jouyo(jouyo(e[i])*jouyo(jouyo(List[i])*jouyo(N-List[i])))
    
print(jouyo(ans))