N = int(input())
A = list(map(int,input().split()))
MOD = 10**9 + 7
ans = 0
count_0 = [0]*60
count_1 = [0]*60
for i in range(60):
    for j in range(N):
        a = A[j]>>i & 1
        if a==0:
            count_0[i] += 1
        else:
            count_1[i] += 1
    tmp = 2**i % MOD
    n = count_0[i] * count_1[i] % MOD
    tmp = tmp * n % MOD
    ans += tmp % MOD
print(ans)