import math

N = int(input())
A = [int(i) for i in input().split()]
digs = int(math.log(max(A), 2)+1)
count = [0] * digs

for i in range(N):
    A_bit = format(A[i], 'b')
    for j in range(len(A_bit)):
        if A_bit[len(A_bit)-1-j] == '1':
            count[j] += 1
total = 0
for i in range(digs):
    total += 2**i * count[i] * (N - count[i])
    
print(total % 1000000007)