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

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = sum((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10 ** 9 + 7
one = [0] * 60

for num in A:
    for digit in range(60):
        one[digit] += num >> digit & 1

for digit in range(60):
    ans += (one[digit] * (N - one[digit]) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10 ** 9 + 7
A_bin = list(map(lambda x: bin(x)[2:].zfill(60), A))
one = [0] * 60

for num in A_bin:
    for digit in range(60):
        one[digit] += int(num[-(digit + 1)])

for digit in range(60):
    ans += (one[digit] * (N - one[digit]) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10 ** 9 + 7
A_bin = list(map(lambda x: bin(x)[2:].zfill(60), A))
zero = [0] * 60
one = [0] * 60

for num in A_bin:
    for digit in range(60):
        if num[-(digit + 1)] == '0':
            zero[digit] += 1
        else:
            one[digit] += 1

for digit in range(60):
    ans += ((zero[digit] * one[digit])  * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
prime = 10 ** 9 + 7
max_digit = len(bin(max(A))[2:])
A_bin = list(map(lambda x: bin(x)[2:].zfill(max_digit), A))
zero = [0] * max_digit
one = [0] * max_digit

for num in A_bin:
    for digit in range(max_digit):
        if num[-(digit + 1)] == '0':
            zero[digit] += 1
        else:
            one[digit] += 1

for digit in range(max_digit):
    ans += (((zero[digit] * one[digit]) % prime) * pow(2, digit, prime)) % prime
    ans %= prime

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
prime = 10 ** 9 + 7
max_digit = len(bin(max(A))[2:])
A_bin = list(map(lambda x: bin(x)[2:].zfill(max_digit), A))
zero = [0] * max_digit
one = [0] * max_digit

for num in A_bin:
    for digit in range(max_digit):
        if num[-(digit + 1)] == '0':
            zero[digit] += 1
        else:
            one[digit] += 1

for digit in range(max_digit):
    ans += ((zero[digit] * one[digit]) % prime) * pow(2, digit, prime)
    ans %= prime

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        ans += A[i] ^ A[j]
        ans %= (10**9 + 7)

print(ans)


Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7

for digit in range(60):
    one = np.count_nonzero((A >> digit) & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD

print(ans)