from collections import Counter
N = int(input())
MAXBIT = 60
MOD = 10 ** 9 + 7
A = list(map(int, input().split()))
B = []
C = [Counter() for _ in range(MAXBIT)]
for a in A:
    b = format(a, '0'+str(MAXBIT)+'b')
    for d in range(MAXBIT):
        C[d].update([b[d]])
ans = 0
for d in range(MAXBIT):
    ans += (C[d]['0'] * C[d]['1']) * (2 ** (MAXBIT-d-1))
    ans %= MOD
print(ans)