n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
p = [pow(2, i, mod) for i in range(60)]
l0 = [n] * 60
l1 = [0] * 60
for i in a:
    t = list(format(i, "b"))
    for j in range(len(t)):
        if int(t[j]) == 1:
            l0[len(t) - 1 - j] -= 1
            l1[len(t) - 1 - j] += 1
ans = 0
for i in range(60):
    ans += (l0[i] * l1[i] * p[i]) % mod
    ans %= mod
print(ans)