Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

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

#k=len(str(bin(max(nums))))-2
if max(nums)==0:
    print(0)
    sys.exit()
else:
    k=int(math.log2(max(nums)))+1

mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
import math

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

#k=len(str(bin(max(nums))))-2
k=int(math.log2(max(nums)))+1

mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=len(str(bin(max(nums))))-2
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
import math

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=int(math.log2(max(nums)))+1
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
import math

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=math.log2(max(nums))+1
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
import math 

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=int(math.log2(max(nums)))+1
mat=[0]*k
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    for i in range(k):
        if num[i]=="1":
            mat[i]+=1

ans=sum([ (N-mat[i])*mat[i]*pow(2,(k-i-1),l) for i in range(k)])
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
import math 

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=int(math.log2(max(nums)))+1
mat=[0]*k
for each in nums:
    num=(str(bin(each))[2:])[::-1]
    kk=len(num)
    for i in range(kk):
        if num[i]=="1":
            mat[i]+=1

ans=sum([ (N-mat[i])*mat[i]*pow(2,i,l) for i in range(k)])
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=len(str(bin(max(nums))))-2
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))

mat=list(zip(*mat))
ans=0

for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=len(str(bin(max(nums))))-2
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))

mat=list(zip(*mat))
ans=0

for i in range(k):
    b=mat[i].count("1")
    
    ans+=b*(N-b)*(2**(k-i-1))
print(ans)

Fixed submission:
mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)