n = int(input())
a = list(map(int, input().split()))
b = [0]*64
for i in range(n):
    c = bin(a[i])[2:]
    for j, q in enumerate(c):
        if q == '1':
            b[i] += 1
c = 0
b = b[::-1]
for i in range(64):
    c += b[i]*(n-b[i])*2**i
print(c % (10**9+7))
