n = int(input())
a = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
ans = 0
i = 1
for _ in range(60):
    b = sum(map(lambda x: x & i != 0, a))
    c = n - b
    ans += b * c * i % mod
    i <<= 1
print(ans%mod)
