N = int(input())
A = list(map(int,input().split()))

nonzero = [0]*60

for i in range(N):
    for j in range(60):
        tmp = (A[i] >> j) & 1
        if tmp != 0:
            nonzero[j] += 1

ans = 0
MOD = 10**9+7

for i in range(60):
    ans += (N-nonzero[i])*nonzero[i]*pow(2,(i),MOD)%MOD
    
print(ans%MOD)
    