bites = [0 for _ in range(60)]
n = int(input())
a_array = map(int, input().split())
for a in a_array:
    a = a << 1
    for i in range(60):
        a = a >> 1
        if not a:
            break
        if a & 1:
            bites[i] += 1
ans = 0
base = 1
for i in range(60):
    if i:
        base *= 2
    base %= 10 ** 9 + 7
    ans += base * bites[i] * (n - bites[i])
    ans %= 10 ** 9 + 7
print(ans)