N=int(input())
A=list(map(int,input().split()))
P=10**9+7
count=[0]*60    #マジックナンバー

def culc(a):
    global count

    i=0
    while a>0:
        if a&1==1:
            count[i]+=1
        a=a>>1
        i+=1

def res():
    global N
    global count

    res=0
    for i in range(len(count)):
        res=(res+(2**i)*count[i]*(N-count[i]))%P

    return res

for index in range(N):
    culc(A[index])

ans=res()
print(ans)

