N = int(input())
A = list(map(int, input().split()))
max_a = max(A)
bit_count = {}
for i in range(len(format(max_a, "b"))):
    bit_count[i] = [0, 0]
# 辞書の初期化が完了
max_value = i
zero_ume = "0" + str(len(format(max_a, "b"))) + "b"
for i in range(N):
    for j in reversed(range(len(format(A[i], zero_ume)))):
        if format(A[i], zero_ume)[j] == "0":
            bit_count[max_value-j][0] += 1
        else:
            bit_count[max_value-j][1] += 1
mod = 10**9+7
ans = 0
for k, v in bit_count.items():
    ans += (2**k) * v[0] * v[1] % mod
print(ans % mod)
