Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d=[[0]*2 for _ in range(60)]

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        d[j][int(lis[i][-j-1])]+=1

ans=0
for i in range(60):
    ans+=(d[i][0]*d[i][1]*2**i)%(10**9+7)
print(ans%(10**9+7))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))
    
for i in range(n):
    lis[i]=lis[i].zfill(l)

d=[[0]*2 for _ in range(60)]

for i in range(n):
    l=len(lis[i])
    for j in range(l):
        d[j][int(lis[i][-j-1])]+=1

ans=0
for i in range(60):
    ans+=(d[i][0]*d[i][1]*2**i)%(10**9+7)
print(ans%(10**9+7))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))
    
for i in range(n):
    lis[i]=lis[i].zfill(l)

d=[[0]*2 for _ in range(60)]

for i in range(n):
    l=len(lis[i])
    for j in range(l):
        d[j][int(lis[i][-j-1])]+=1

ans=0
for i in range(60):
    ans+=(d[i][0]*d[i][1]*2**i)%(10**9+7)
print(ans%(10**9+7))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it
N=input()
a_l=[int(i) for i in input().split()]

def xor(i,j):
    l=len(str(format(max(i,j),'b')))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    yield ans

sum1=0
for (i,j) in it.combinations(a_l, 2):
    for k in xor(i,j):
        sum1+=k
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it
N=input()
a_l=[int(i) for i in input().split()]

sum1=0
for (i,j) in it.combinations(a_l, 2):
        sum1+=i^j
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_l=[int(i) for i in input().split()]

sum1=0
for (i,j) in it.combinations(a_l, 2):
        sum1+=i^j
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_l=[int(i) for i in input().split()]

sum1=0
for (i,j) in it.combinations(a_l, 2):
        sum1+=i^j
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a_l=[int(i) for i in input().split()]

sum1=0
j=1
for i in range(N-1):
    while j<N:
        sum1+=a_l[i]^a_l[j]
        j+=1
    j=i+2
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a_l=[int(i) for i in input().split()]

def xor(i,j):
    l=len(str(format(max(i,j),'b')))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
j=1
for i in range(N-1):
    while j<N:
        sum1+=xor(a_l[i],a_l[j])
        j+=1
    j=i+2
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it

N=int(input())
a_l=[int(i) for i in input().split()]

sum1=0
for (i,j) in it.combinations(a_l, 2):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    for k in range(l):
        if i2[k]!=j2[k]:
            sum1 += 2**(l-k-1)
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools as it

N=int(input())
a_l=np.array([int(i) for i in input().split()])

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
for (i,j) in it.combinations(a_l, 2):
        sum1+=xor(i,j)
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N=int(input())
a_l=np.array([int(i) for i in input().split()])

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
for i in range(N-1):
    for j in a_l[i+1:]:
        sum1+=xor(a_l[i],j)
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N=int(input())
a_l=[int(i) for i in input().split()]

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
for (i,j) in itertools.product(range(N), range(N)):
    if i<j:
        sum1+=xor(a_l[i],a_l[j])
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a_l=[int(i) for i in input().split()]

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
for i in range(N-1):
    for j in range(N-1-i):
        sum1+=xor(a_l[i],a_l[j+i+1])
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a_l=[int(i) for i in input().split()]

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
j=1
for i in range(N-1):
    while j<N:
        sum1+=xor(a_l[i],a_l[j])
        j+=1
    j=i+2
print(sum1%(7+10**9))

Fixed submission:
n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))