import numpy as np
MOD = 10**9 + 7
n = int(input())
array = np.array([list(map(int, format(num, "060b")))[::-1] for num in map(int, input().split())], dtype="int64")
sum_ = 0
for idx, column in enumerate(array.T):
    n_ones = column.sum()
    sum_ += ((n_ones * (n - n_ones)) % MOD) * ((2 ** idx) % MOD) % MOD
    sum_ %= MOD
print(sum_)