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

bit = [0] * 61
for i in range(N):
    for x in range(61):
        if 2**x > A[i]:
            break
        elif (1<<x) & A[i] > 0:
            bit[x] += 1

ans = 0
for i in range(61):
    ans += 2**i * (bit[i] * (N-bit[i]))
    ans %= MOD

print(ans)