N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10 ** 9 + 7
one = [0] * 60

for num in A:
    for digit in range(60):
        one[digit] += num >> digit & 1

for digit in range(60):
    ans += (one[digit] * (N - one[digit]) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)
