N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10 ** 9 + 7
A_bin = list(map(lambda x: bin(x)[2:].zfill(60), A))
zero = [0] * 60
one = [0] * 60

for num in A_bin:
    for digit in range(60):
        if num[-(digit + 1)] == '0':
            zero[digit] += 1
        else:
            one[digit] += 1

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

print(ans)
