M = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))

zero = [0] * 60
one = [1] * 60
pow2 = [2 ** i % M for i in range(60)]


def bitcnt(a):
    j = 0
    bits = [0] * 60
    while a:
        bits[j] = a & 1
        a >>= 1
        j += 1
    return bits


ans = 0
a1 = bitcnt(A[0])
a0 = [(x + 1) % 2 for x in a1]
for i in range(1, N):
    for j, b1 in enumerate(bitcnt(A[i])):
        b0 = (b1 + 1) % 2
        ans += pow2[j] * (a0[j] * b1 % M) % M
        ans += pow2[j] * (a1[j] * b0 % M) % M
        ans %= M
        a1[j] = (a1[j] + b1) % M
        a0[j] = (a0[j] + b0) % M

print(ans)
