import numpy as np
MOD = 10**9 + 7
n = int(input())
A = np.array(list(map(int, input().split())))

answer = 0
for i in range(60):
    n_ones = (A & 1).sum()
    answer += 2 ** i * (n - n_ones) * n_ones
    A >>= 1

print(answer % MOD)