n = int(input())
a_list = list(map(int, input().split()))
# 各bitの1の総数を数える
ones = [0] * 61
for a in a_list:
    for i, b in enumerate(bin(a)[:1:-1]):
        ones[i] += int(b)
ans = 0
for i, k in enumerate(ones):
    ans += 2 ** i * k * (n - k)
print(ans % (10 ** 9 + 7))
