N = int(input())
A = list(map(lambda x: format(int(x), '060b'), input().split(' ')))
mod = 10 ** 9 + 7
one = [0]*60
ans = 0
for i in A:
    for n, j in enumerate(i[::-1]):
        if int(j):
            one[n] += 1
for n,i in enumerate(one):
    ans = (ans + 2**n *i*(N-i))%mod
print(ans)