N = int(input())
A= list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = 0
for i in range(60):
    count0 = 0
    count1 = 0
    count2 = 0

    for j in range(N):
        if A[j] & 1:
            count1 += 1
        else:
            count0 += 1
        A[j] = A[j] >> 1
    count2 = count0 * count1
    sum += count2 * (2 ** i)

print(sum % mod)
