N = int(input())
A = list(map(int,input().split()))
MOD = 10 ** 9 + 7

K = []
for a in A:
    L = list(format(a, 'b').zfill(61))
    M = list(int(s) for s in L)
    K.append(M)

cnt = []
for i in range(61):
    temp_1 = 0
    for j in range(N):
        if K[j][i] == 1:
            temp_1 += 1
    temp_0 = N - temp_1
    cnt.append(temp_0 * temp_1)
cnt.reverse()

ans = 0
for i in range(61):
    ans += (2 ** i) * cnt[i] % MOD

print(ans % MOD)