#標準入力の受け取り
N = int(input())
A = list(map(int, input().split()))

#Aをbitに表記し直して二次元配列に格納
bit_lis = []
for i in range(N):
    mini_bit_lis = []
    tmp = A[i]
    for j in range(61):
        mini_bit_lis.append(tmp % 2)
        tmp = tmp // 2
    bit_lis.append(mini_bit_lis)

#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    for j in range(N):
        if bit_lis[j][i] == 1:
            bit_1 += 1
    if bit_1 == 0:
        continue
    ans += (2 ** i) * bit_1 * (N-bit_1)
    bit_1 = 0
    ans = ans % mod
print(ans)