MOD = 1000000007

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

digits = [0] * 60
for i in A:
    for j in range(60):
        if i>>j&1 == 1:
            digits[j] += 1

ans = 0
for i in range(60):
    ans += digits[i] * (N - digits[i]) * (1<<i)
    ans %= MOD

print(ans)