# coding: utf-8
MOD = 10**9 + 7

n = int(input())
inputs = list(map(int, input().split()))

count_list = [0] * 60
for i in inputs:
    tmp = bin(i)[2:].zfill(60)
    for i in range(60):
        count_list[i] += int(tmp[i])

result_list = []
result = 0
for i in range(60):
    keta_result = count_list[i] * (n - count_list[i])
    result += keta_result * (2 ** (60 - 1 - i))
print(result % MOD)