N = int(input())
A = list(map(int, input().split()))

each_bit_sum = [{"0": 0, "1": 0} for _ in range(62)]
result = 0
for a in A:
    for i, b in enumerate(format(a, "b").zfill(62)[::-1]):
        each_bit_sum[i][b] += 1

for i, b in enumerate(each_bit_sum):
    result += ((b["0"] * b["1"]) * (2**i)) % ((10**9) + 7)

print(result % ((10**9) + 7))
