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

ans = 0
for k in range(61):
    num1 = 0
    for a in A:
        if (a >> k) & 1:
            num1 += 1
    ans += (num1 * (N-num1)) << k
    ans %= mod

print(ans)