Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
A = np.array(list(map(int, input().split())))
mod = 10 ** 9 + 7

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)


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

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)

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

bit2 = [0] * 80
for i in range(N):
  bin_a = bin(A[i])
  #print(bin_a)#2なら0b10と返す
  str_bin_a = str(bin_a)[2:]
  #print(str_bin_a)
  l = len(str_bin_a)
  for j in range(l):
    bit2[j] += int(str_bin_a[-(j + 1)])
    
#print(bit2)
ans = 0
for i in range(80):
  count1 = bit2[i]
  count0 = N - count1
  ans += ((2 ** i) * count0 * count1) % MOD
  
print(ans % MOD)
  
  

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

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)

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

bit2 = [0] * 80
for i in range(N):
  bin_a = bin(A[i])
  #print(bin_a)#2なら0b10と返す
  str_bin_a = str(bin_a)[2:]
  #print(str_bin_a)
  l = len(str_bin_a)
  for j in range(l):
    bit2[j] += int(str_bin_a[-(j + 1)])
    
#print(bit2)
ans = 0
for i in range(80):
  count1 = bit2[i]
  count0 = N - count1
  ans += ((2 ** i) * count0 * count1) % MOD
  
print(ans % MOD)
  
  

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

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

bit2 = [0] * 20
for i in range(N):
  bin_a = bin(A[i])
  #print(bin_a)#2なら0b10と返す
  str_bin_a = str(bin_a)[2:]
  #print(str_bin_a)
  l = len(str_bin_a)
  for j in range(l):
    bit2[j] += int(str_bin_a[-(j + 1)])
    
#print(bit2)
ans = 0
for i in range(20):
  count1 = bit2[i]
  count0 = N - count1
  ans += (2 ** i) * count0 * count1
  
print(ans)
  
  

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

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)

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

def xor(a, b):
  return a^b

ans = 0
for i in range(N-1):
  for j in range(i + 1, N):
    ans += (xor(A[i] , A[j])) % MOD

print(ans%MOD)


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

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)

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

def xor(a, b):
  return a^b

ans = 0
for i in range(N-1):
  for j in range(i + 1, N):
    ans += xor(A[i] , A[j])
    ans = ans % MOD

print(ans%MOD)


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

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    #print(tmp)
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)