n = int(input())
a = [int(x) for x in input().split()]
MOD = 1000000007
ans = 0
for digit in range(60):
    ones = 0
    for num in a:
        if num >> digit & 1:
            ones += 1
    zeroes = n - ones  # Zeros?
    ans = (ans + ones * zeroes * pow(2, digit, MOD)) % MOD

print(ans)
