N = int(input())
a = list(input().split())
A = [int(a[i])for i in range(N)]
frag = [0 for i in range(60)]
mod = 10 ** 9 + 7

for i in range(N):
    for j in range(len(bin(A[i])) - 2):
        if A[i] & (1 << j):
            frag[j] += 1

print(sum([(frag[i] * (N - frag[i]) * 2 ** i) for i in range(60)]) % mod)