mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))
tmp = 0
for i in range(61):
    tmp_0 = 0
    for j in range(N):
        if ((A[j] >> i) & 1) == 0:
            tmp_0 += 1
    tmp += ((tmp_0)*(N - tmp_0)*(2**i)) % mod
print(tmp % mod)