n = int(input())
a = list(map(int, input().split()))

c = [0] * 60

const = 10 ** 9 + 7

ans = 0

"""
for i in range(n):
    b = str(bin(a[i]))
    for j in range(len(b) - 2):
        k = - j - 1
        c[j] += int(b[k])
"""

for i in range(n):
    b = a[i]
    t = 0
    while t <= 60:
        if b == 0:
            break
        elif b == 1:
            c[t] += 1
            break
        else:
            q, mod = divmod(b, 2)
            b = q
            c[t] += mod
            t += 1

for i in range(60):
    ans += (((2 ** i) % const) * (c[i] * (n - c[i]))) % const

print(ans % const)
