n = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

bit_count = [0] * 60
ans = 0
for a in A:
    for bit in range(60):
        if (a >> bit) & 1:
            count = bit_count[bit]
            ans += (2 ** bit) * (n-1-count*2)
            bit_count[bit] += 1
            ans %= mod
        else:
            continue

print(ans)