N = int(input())
A = map(int, input().split())
MOD = 10 ** 9 + 7

counts = [0] * 60
for a in A:
    for i in range(60):
        counts[i] += (a >> i) % 2

power2 = [1]
for _ in range(59):
    power2.append((power2[-1] * 2) % MOD)


ans = sum(c * (N - c) * power2[i] for i, c in enumerate(counts))

print(ans % MOD)
