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

ans = 0
for k in range(0, 100):
    num1 = 0
    num0 = 0
    for a in A:
        if (a >> k) & 1:
            num1 += 1
        else:
            num0 += 1

    ans += num1 * num0 * pow(2, k) % mod
    ans %= mod

print(ans)
