N = int(input())
A = [int(i) for i in input().split()]

lis = [0]*60

for a in A:
    for i in range(60):
        lis[i] += a%2
        a = a //2

ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)

print(ans)