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

bit_nums = [0 for _ in range(K)]
ans = 0
mod = 10 ** 9 + 7

for a in A:
    for i in range(K):
        if a >> i & 1 == 1:
            bit_nums[i] += 1

ans = 0
for i in range(K):
    ans += (2 ** i) * (bit_nums[i] * (N - bit_nums[i]))
    ans %= mod
    
print(ans)