N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: format(x, '0b').zfill(60), A))

p = int(1e9+7)
res = 0
d = [0]*60

for a in A:
    for i in range(60):
        d[i] += int(a[i])

for i, d in enumerate(d[::-1]):
    res += d*(N-d)*2**i
    res %= p

print(res)