N = int(input())

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

cnt = [0] * 62

for index in range(N):
    temp = A[index]
    keta = 0
    while (temp > 0):
        cnt[keta] += temp & 1

        keta += 1
        temp >>= 1

# print(cnt)
ans = 0
keta = 1
for kaku in cnt:
    ans = (ans + (kaku * (N - kaku)) * keta) % 1000000007
    keta *= 2

print(ans)