Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
 
ans = 0
twopow = 1
for n in range(60):
    one = 0
    for i in range(N):
        one += A[i] & 1
        A[i] >>= 1
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    twopow = twopow << 1 % MOD

print(ans)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

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

ans = 0
twopow = 1
for n in range(60):
    one = sum( ((Ai >> n) & 1) for Ai in A )
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    twopow = twopow << 1 % MOD

print(ans)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.reverse()
sum = 0
check = []
num = []
sub = []
a = subb = 0
for i in range(1, N):
    sub_sum = 0
    if A[i] in check:
        a = check.index(A[i])
        for j in range(num[a], i):
            sub_sum += A[i] ^ A[j]
        subb = sub_sum + sub[a]
        sum += subb
        sub[a] = subb
    else:
        check.append(A[i])
        num.append(i)
        for j in range(i):
            sub_sum += A[i] ^ A[j]
        sum += sub_sum
        sub.append(sub_sum)
print(sum%1000000007)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.reverse()
sum = 0
xor = 0
cnt = [[0]*2]*N
for i in range(1, N):
    if A[i] in cnt:
        sum += cnt[A[i]][0]
        for j in range(cnt[A[i]][1], i):
            a = A[i] ^ A[j]
            xor += a
            sum += a
        cnt[A[i]][0] = xor + cnt[A[i]][0]
        cnt[A[i]][1] = i
    else:
        for j in range(i):
            a = A[i] ^ A[j]
            xor += a
            sum += a
        cnt[A[i]][0] = xor
        cnt[A[i]][1] = i
print(sum%1000000007)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
sum = 0
cnt = []
for i in range(N-1):
    if A[i] in cnt:
        sum += a
    else:
        for j in range(i+1, N):
            a = A[i] ^ A[j]
            sum += a
print(sum%1000000007)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
sum = 0
cnt = []
for i in range(N-1):
    if A[i] in cnt:
        sum += a
    else:
        for j in range(i+1, N):
            a = A[i] ^ A[j]
            sum += a
print(sum%1000000007)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum += A[i] ^ A[j]
print(sum%1000000007)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum += A[i] ^ A[j]
print(sum%1000000007)

Fixed submission:
import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

print(ans)