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

ans = sum(c * (N - c) * (2 ** i % MOD) % MOD for i, c in enumerate(counts))

print(ans % MOD)
