Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
table=[0]*60
for v  in map(int,input().split()):
    for j in range(60):
        if v%2:table[j]+=1
        v//=2
        if v==0:break
ans=0
mod=10**9+7
a=1

for o in table:
    z=(n-o)
    ans=(ans+o*z%mod*a)%mod
    a=a*2%mod
print(ans)

Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
table=[0]*60
for i,v  in enumerate(map(int,input().split())):
    for j in range(60):
        table[j]+=v%2
        v//=2
        if v==0:break
ans=0
mod=10**9+7
a=1
n%=mod
for o in table:
    z=(n-o)%mod
    o%=mod
    ans=(ans+o*z*a)%mod
    a=a*2%mod
print(ans)

Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
table=[0]*60
for i,v  in enumerate(map(int,input().split())):
    for j in range(60):
        table[j]+=v%2
        v//=2
        if v==0:break
#print(*table,sep='\n')
ans=0
mod1,mod2=10**9+7,998244353
mod=mod1
a=1
for o in table:
    z=n-o
    ans=(ans+o*z*a)%mod
    a=a*2%mod
print(ans)

Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
table=[[0]*n for i in range(60)]
for i,v  in enumerate(map(int,input().split())):
    for j in range(60):
        table[j][n-1-i]=v%2
        v//=2
        if v==0:break
#print(*table,sep='\n')
ans=0
mod1,mod2=10**9+7,998244353
mod=mod1
a=1
for t in table:
    o,z=0,0
    
    for v in t:
        if v:
            o+=1
            ans=(ans+z*a)%mod
        else:
            z+=1
            ans=(ans+o*a)%mod

    a=a*2%mod
print(ans)

Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(c) for c in input().spilt()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)


Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(c) for c in input().splt()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
mod=10**9+7
l=list(map(int,input().split()))
d=len(str(bin(max(l))))-2
ll=[[0,0] for i in range(d)]
ans=0
for i in l:
  for j,v in enumerate(bin(i)[2:].zfill(d)):
    ll[d-j-1][int(v)]+=1
for i,(a,s) in enumerate(ll):
  ans+=(2**i%mod)*a*s%mod
  ans%=mod
print(ans)

Fixed submission:
n=int(input())
l=[int(c) for c in input().split()]
ans=0
mod=10**9+7
for i in range(60):
  s=sum(a>>i&1 for a in l)
  ans+=s*(n-s)<<i%mod
  ans%=mod
print(ans)