Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7



ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1

    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod

print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
mod = 10**9+7
 
 
 
ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1
 
    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7

mm0 = [0 for i in range(60)]
mm1 = [0 for i in range(60)]

for i in range(n):
    for j in range(60):
        if (a[i]>>j)<0:
            break
        if (a[i]>>j)&1:
            mm1[j] += 1

ans = 0
for i in range(60):
    ttl = ((n-mm1[i])*mm1[i])
    ans += (((1<<i)%mod)*((ttl)%mod))%mod
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
mod = 10**9+7
 
 
 
ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1
 
    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7

mm0 = [0 for i in range(60)]
mm1 = [0 for i in range(60)]

for i in range(n):
    for j in range(60):
        if (a[i]>>j)<0:
            break
        if (a[i]>>j)&1:
            mm1[j] += 1

ans = 0
for i in range(60):
    ttl = ((n-mm1[i])*mm1[i])
    ans += ((1<<i)%mod)*((ttl)%mod)
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
mod = 10**9+7
 
 
 
ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1
 
    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7

mm0 = [0 for i in range(60)]
mm1 = [0 for i in range(60)]

for i in range(n):
    for j in range(60):
        if (a[i]>>j)<0:
            break
        if (a[i]>>j)&1:
            mm1[j] += 1

ans = 0
for i in range(60):
    ttl = (n-mm1[i])*mm1[i]
    ans += ((1<<i)*ttl)%mod
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
mod = 10**9+7
 
 
 
ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1
 
    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7

mm0 = [0 for i in range(61)]
mm1 = [0 for i in range(61)]

for i in range(n):
    for j in range(61):
        if (a[i]>>j)<0:
            break
        if (a[i]>>j)&1:
            mm1[j] += 1

ans = 0
for i in range(61):
    ttl = (n-mm1[i])*mm1[i]
    ans += ((1<<i)*ttl)%mod
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
mod = 10**9+7
 
 
 
ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1
 
    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

mod = 10**9+7

mm0 = [0 for i in range(61)]
mm1 = [0 for i in range(61)]

for i in range(n):
    for j in range(61):
        if (a[i]>>j)<0:
            break
        if (a[i]>>j)&1:
            mm1[j] += 1

for i in range(61):
    mm0[i] = n-mm1[i] 

ans = 0

for i in range(61):
    ttl = mm0[i]*mm1[i]
    ans += ((1<<i)*ttl)%mod
    ans %= mod

print(ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
mod = 10**9+7
 
 
 
ans = 0
q2 = 1
for j in range(60):
    mm1 = 0
    for i in range(n):
        if a[i]>>j&1:
            mm1 += 1
 
    ttl = ((n-mm1)*mm1)
    ans += ((q2)*((ttl)%mod))%mod
    ans %= mod
    q2 = (q2*2)%mod
 
print(ans)