N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9 + 7
B0 = [0] * 60
B1 = [0] * 60
a = A.pop()
for b in range(60):
    if (a >> b) & 1:
        B1[b] += 1
    else:
        B0[b] += 1
ans = 0
for a in A:
    for b in range(60):
        if (a >> b) & 1:
            ans += (1 << b) * B0[b]
            B1[b] += 1
        else:
            ans += (1 << b) * B1[b]
            B0[b] += 1
        ans %= mod
print(ans)
