N = int(input())
A = list(map(int, input().split()))

MOD = 10**9 + 7

ans = 0
two_factor = 1
for d in range(60):
    n0 = 0
    n1 = 0
    for i in range(N):
        if A[i] & (1<<d):
            n1 += 1
        else:
            n0 += 1
    tmp = (1<<d) % MOD
    n = n0 * n1 % MOD
    tmp = tmp * n % MOD
    ans = (ans + tmp) % MOD

print(ans)
