N=int(input())
A=list(map(int,input().split()))
digit=[0 for i in range(0,61)]
for i in range(0,N):
    for j in range(0,60):
        digit[j+1]+=(A[i]>>j)&1
ans=((N-1)*sum(A))%(10**9+7)
subans=[(digit[k]*(digit[k]-1)*2**(k-1))%(10**9+7) for k in range(1,61)]
print(ans-sum(subans))