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 i in range(K):
    bit_nums[i] = sum([1 if a >> i & 1 == 1 else 0 for a in A])

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