N = int(input())
A = list(map(int, input().split()))
counter = [0] * 60
for i in range(N):
    bA = bin(A[i])
    for j in range(len(bA)-2):
        if bA[j+2] == '1':
            counter[60+j-(len(bA)-2)] += 1
res = 0
for i in range(60):
    res += (((counter[i] * (N-counter[i])) % (10**9+7)) * ((2 ** (59-i))) % (10**9+7))
print(res%(10**9+7))
