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(60):
    ans += (2 ** i * (c[i] * (n - c[i]))) % const

print(ans % const)
