Buggy python submission (verdict: Time Limit Exceeded):
#標準入力の受け取り
N = int(input())
A = list(map(int, input().split()))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(N):
    tmp = A[i]
    for j in range(61):
        bit_lis[j] += tmp % 2
        tmp = tmp // 2
        if tmp == 0:
            break
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += pow(2, i, mod) * bit_1 * (N-bit_1) 
    ans = ans % mod
print(ans)

Fixed submission:
#標準入力の受け取り
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(61):
    bit_lis[i] = np.count_nonzero(A & 1)
    A >>=1
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += pow(2, i, mod) * bit_1 * (N-bit_1) 
    ans = ans % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#標準入力の受け取り
N = int(input())
A = list(map(int, input().split()))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(N):
    tmp = A[i]
    for j in range(61):
        bit_lis[j] += tmp % 2
        tmp = tmp // 2
        if tmp == 0:
            break
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += (2 ** i) * bit_1 * (N-bit_1) % mod
    ans = ans % mod
print(ans)

Fixed submission:
#標準入力の受け取り
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(61):
    bit_lis[i] = np.count_nonzero(A & 1)
    A >>=1
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += pow(2, i, mod) * bit_1 * (N-bit_1) 
    ans = ans % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#標準入力の受け取り
N = int(input())
A = list(map(int, input().split()))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(N):
    tmp = A[i]
    for j in range(61):
        bit_lis[j] += tmp % 2
        tmp = tmp // 2
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    ans += (2 ** i) * bit_1 * (N-bit_1) % mod
    ans = ans % mod
print(ans)

Fixed submission:
#標準入力の受け取り
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(61):
    bit_lis[i] = np.count_nonzero(A & 1)
    A >>=1
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += pow(2, i, mod) * bit_1 * (N-bit_1) 
    ans = ans % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#標準入力の受け取り
N = int(input())
A = list(map(int, input().split()))

#Aをbitに表記し直して二次元配列に格納
bit_lis = []
for i in range(N):
    mini_bit_lis = []
    tmp = A[i]
    for j in range(61):
        mini_bit_lis.append(tmp % 2)
        tmp = tmp // 2
    bit_lis.append(mini_bit_lis)

#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    for j in range(N):
        if bit_lis[j][i] == 1:
            bit_1 += 1
    if bit_1 == 0:
        continue
    ans += (2 ** i) * bit_1 * (N-bit_1)
    bit_1 = 0
    ans = ans % mod
print(ans)

Fixed submission:
#標準入力の受け取り
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(61):
    bit_lis[i] = np.count_nonzero(A & 1)
    A >>=1
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += pow(2, i, mod) * bit_1 * (N-bit_1) 
    ans = ans % mod
print(ans)