Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
*A, = map(int, input().split())
p = 10**9+7
A = [list(format(a, '060b')) for a in A]
s = 0
for i in range(60):
    Ai = [a[i] for a in A]
    c0 = Ai.count('0')
    c1 = n-c0
    c = c0*c1
    s = (s+c*(2**(59-i))) % p
print(s)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
*A, = map(int, input().split())
p = 10**9+7
A = [list(format(a, '060b')) for a in A]
s = 0
for i in range(60):
    Ai = [int(a[i]) for a in A]
    c0 = Ai.count(0)
    c1 = Ai.count(1)
    c = c0*c1
    s = (s+c*(2**(59-i))) % p
print(s)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
*A, = map(int, input().split())
p = 10**9+7
A = [list(format(a, '060b'))[::-1] for a in A]
A = [[int(a[i]) for a in A] for i in range(60)]
s = 0
for i in range(60):
    Ai = A[i]
    c0 = Ai.count(0)
    c1 = Ai.count(1)
    c = c0*c1
    s = (s+c*(2**i)) % p
print(s)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
*A, = map(int, input().split())
p = 10**9+7
A = [list(format(a, '060b'))[::-1] for a in A]
A = [[int(a[i]) for a in A] for i in range(60)]
s = 0
for i in range(60):
    Ai = A[i]
    c0 = Ai.count(0)
    c1 = Ai.count(1)
    c = c0*c1
    s = (s+c*(2**i)) % p
print(s)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=0
mod=10**9+7
for k in range(60):
    count=0
    for a in A:
        count+=int(a&(1<<k)>0)
    ans+=count*(N-count)*(2**k)
print(ans%mod)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=0
mod=10**9+7
for k in range(60):
    count=sum([int(bin(a)[2:].zfill(60)[k]) for a in A])
    ans+=count*(N-count)*(2**(60-k-1))
print(ans%mod)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
A=[bin(a)[2:].zfill(60) for a in A]
ans=0
mod=10**9+7
for k in range(60):
    count=sum([int(a[k]) for a in A])
    ans+=count*(N-count)*(2**(60-k-1))
print(ans%mod)


Fixed submission:
N=int(input())
A=[format(i,'060b') for i in map(int,input().split())]
ans=0
mod=10**9+7
for k in range(60):
    count=[a[60-1-k] for a in A].count('0')
    ans+=count*(N-count)*(2**k)%mod
print(ans%mod)