import numpy as np
mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))
A = np.array(A, dtype = np.int64)
tmp = 0
for i in range(61):
    tmp_1 = np.sum((A >> i) & 1 )
    tmp += ((tmp_1)*(N - tmp_1)*(2**i)) % mod
print(tmp % mod)