Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
result = [0 for _ in range(120)]
for i in a:
    x = format(i, "060b")[::-1]
    for j in range(60):
        result[j] = result[j]+(x[j]=="1")
result = [(n-i)*i for i in result]
for i in range(70):
    result[i+1] += result[i]//2
    result[i] = result[i]%2    
print(int("".join(map(str, result[::-1])), 2)%mod)

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
result = [0 for _ in range(120)]
for i in a:
    x = format(i, "060b")[::-1]
    for j in range(60):
        result[j] = result[j]+(x[j]=="1")
result = [(n-i)*i for i in result]
for i in range(119):
    result[i+1] += result[i]//2
    result[i] = result[i]%2    
print(int("".join(map(str, result[::-1])), 2)%mod)

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
mod = 10**9+7
n = int(input())
a = np.array(list(map(int,input().split())))

result = 0
for i in range(62):
    count_one = sum(a%2)
    bina = 1
    for j in range(i):
        bina = bina*2%mod
    result += count_one*(n-count_one)*bina%mod
    a = a >> 1
print(result%mod)

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
binary = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 73741817, 147483634, 294967268, 589934536, 179869065, 359738130, 719476260, 438952513, 877905026, 755810045, 511620083, 23240159, 46480318, 92960636, 185921272, 371842544, 743685088, 487370169, 974740338, 949480669, 898961331, 797922655, 595845303, 191690599, 383381198, 766762396, 533524785, 67049563, 134099126, 268198252, 536396504]

n = int(input())
a = [format(i,"b") for i in map(int, input().split())]
mod = 10**9+7
b = [0 for _ in range(61)]

for i in range(n):
    for j in range(len(a[i])):
        b[j] += int(a[i][-j-1])

result = 0
for i in range(61):
    r = b[i]*(n-b[i])%mod
    r = r*binary[i]%mod
    result += r
print(result%mod)

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
binary = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 73741817, 147483634, 294967268, 589934536, 179869065, 359738130, 719476260, 438952513, 877905026, 755810045, 511620083, 23240159, 46480318, 92960636, 185921272, 371842544, 743685088, 487370169, 974740338, 949480669, 898961331, 797922655, 595845303, 191690599, 383381198, 766762396, 533524785, 67049563, 134099126, 268198252, 536396504]

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
b = [0 for _ in range(max_len)]

for i in range(n):
    count = 0
    while a[i] > 0:
        b[count] += a[i]%2
        a[i] //= 2
        count += 1

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])%mod
    r = r*binary[i]%mod
    result += r
print(result%mod)

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = [format(i, "b") for i in map(int, input().split())]
    mod = 10**9+7
    b = [0 for _ in range(61)]

    for i in range(n):
        for j in range(1, len(a[i])+1):
            b[j-1] += int(a[i][-j])

    result = 0
    for i in range(61):
        r = b[i]*(n-b[i])%mod
        for j in range(i):
            r = r*2 %mod
        result += r
    print(result%mod)

if __name__=="__main__":
    main()

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9+7
    max_len = len(format(max(a), "b"))
    b = [0 for _ in range(max_len)]

    for i in range(n):
        count = 0
        while a[i] > 0:
            b[count] += a[i]%2
            a[i] //= 2
            count += 1

    result = 0
    for i in range(max_len):
        r = b[i]*(n-b[i])%mod
        for j in range(i):
            r = r*2 %mod
        result += r
    print(result%mod)

if __name__=="__main__":
    main()

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
b = [0 for _ in range(max_len)]

for i in range(n):
    count = 0
    while a[i] > 0:
        b[count] += a[i]%2
        a[i] //= 2
        count += 1

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])%mod
    for j in range(i):
        r = r*2 %mod
    result = result+r % mod
print(result%mod) 

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
b = [0 for _ in range(max_len)]

for i in range(n):
    count = 0
    while a[i] > 0:
        b[count] += a[i]%2
        a[i] //= 2
        count += 1

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])%mod
    r = (r*2**i) %mod
    result += r
print(result%mod) 

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
a = [format(a[i], "b") for i in range(n)]
b = [0 for _ in range(max_len)]

for i in range(n):
    for j in range(1, 1+len(a[i])):
        b[j-1] += int(a[i][-j])

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])%mod
    r = (r*2**i) %mod
    result += r
print(result%mod) 

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
a = [format(a[i], "b") for i in range(n)]
b = [0 for _ in range(max_len)]

for i in range(n):
    for j in range(1, 1+len(a[i])):
        if int(a[i][-j]):
            b[j-1] += 1

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])%mod
    r = (r*2**i) %mod
    result += r
print(result%mod) 

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
a = [format(a[i], "b") for i in range(n)]
b = [0 for _ in range(max_len)]

for i in range(n):
    for j in range(1, 1+len(a[i])):
        if int(a[i][-j]):
            b[j-1] += 1

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])
    for j in range(i):
        r = r*2 %mod
    result += r
print(result%mod) 

Fixed submission:
import numpy as np
mod = 10**9+7
n = int(input())
a = np.fromstring(input(), dtype = np.int64, sep = ' ')

result = 0
for i in range(60):
    count_one = int((a&1).sum())
    result += count_one*(n-count_one)*(2**i)
    a >>= 1
print(result%mod)