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

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