Buggy python submission (verdict: Time Limit Exceeded):
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<len(str(bin(item)))-2:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1
    k=len(str(bin(item)))-2
    while k<61:
        aze[k]+=1
        k+=1


        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]%MOD*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Fixed submission:
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<61:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1

        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]%MOD*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Buggy python submission (verdict: Time Limit Exceeded):
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<len(str(bin(item)))-2:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1
    k=len(str(bin(item)))-2
    while k<61:
        aze[k]+=1
        k+=1


        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Fixed submission:
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<61:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1

        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]%MOD*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Buggy python submission (verdict: Time Limit Exceeded):
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<len(str(bin(item)))-2:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1
    k=len(str(bin(item)))-2
    while k<61:
        aze[k]+=1
        k+=1


        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)*abi[i]*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)




Fixed submission:
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<61:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1

        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]%MOD*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Buggy python submission (verdict: Time Limit Exceeded):
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*64
aze=[0]*64

for item in a:
    j=0
    #print(bin(item))
    while j<len(str(bin(item)))-2:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1
    k=len(str(bin(item)))-2
    while k<64:
        aze[k]+=1
        k+=1


        #print(abi)

result=0
i=0
while i<64:
    result+=(2**i)*abi[i]*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Fixed submission:
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<61:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1

        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]%MOD*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Buggy python submission (verdict: Time Limit Exceeded):
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*64
aze=[0]*64

for item in a:
    j=0
    #print(bin(item))
    while j<len(str(bin(item)))-2:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1
    k=len(str(bin(item)))-2
    while k<64:
        aze[k]+=1
        k+=1


        #print(abi)

result=0
i=0
while i<64:
    result+=(2**i)*abi[i]*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""

Fixed submission:
import sys
MOD=10**9+7

n=int(input())
a=list(map(int,input().split()))

abi=[0]*61
aze=[0]*61

for item in a:
    j=0
    #print(bin(item))
    while j<61:
        #print(j)
        if item>>j & 1:
            abi[j]+=1
        else:
            aze[j]+=1
        j+=1

        #print(abi)

result=0
i=0
while i<61:
    result+=(2**i)%MOD*abi[i]%MOD*(aze[i])%MOD

    i+=1

#print(abi[:4])

#print(aze[:4])
print(result%MOD)


"""
01
10
11
"""



"""
0001
0010
0011
0100
0101
0110
0111
"""