def tentwo(N):
    ret = [0] * 60
    NN = N
    for i in range(60):
        ret[i] = NN % 2
        NN //= 2
    return ret

N = int(input())

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

B = [0] * N

for i in range(N):
    B[i] = tentwo(A[i])

ans = 0
for j in range(60):
    count = 0
    for i in range(N):
        if B[i][j] == 1:
            count += 1
    ans = (ans + (count * (N-count)) * (2 ** j)) % (10**9 + 7)

print(ans)