N=int(input())
A=list(map(int,input().split()))

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

List = []        
for i in range(1,M+1):
    count = 0
    for j in range(N):
        if A[j]%(2**i) >= 2**(i-1):
            count = count +1
        else:
            count = count
    List.append(count)
    
ans = 0   
for i in range(M):
    ans = ans + (2**i)*List[i]*(N-List[i])
    
print(ans%1000000007)