Buggy python submission (verdict: Time Limit Exceeded):
mod = 10 ** 9 + 7

N = int(input())
A = tuple(map(int, input().split()))

ans = 0
for i in range(60):
    cnt = sum((A_i >> i) & 1 for A_i in A)
    ans += (1 << i) * cnt * (N - cnt)

print(ans % mod)

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = tuple(map(int, f_i.readline().split()))
    
    ans = 0
    for i in range(60):
        cnt = sum((A_i >> i) & 1 for A_i in A)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = map(int, f_i.readline().split())
    
    bit_count = [0] * 60
    for A_i in A:
        b = 0
        while A_i:
            bit_count[b] += A_i & 1
            A_i >>= 1
            b += 1
    
    ans = 0
    bit = (1 << i for i in range(60))
    for b, c in zip(bit, bit_count):
        ans += b * c * (N - c)
    
    print(ans % mod)

solve()

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = list(map(int, f_i.readline().split()))
    
    ans = 0
    b = 1
    while A:
        next_A = []
        
        bit_cnt = 0
        
        for A_i in A:
            if A_i & 1:
                bit_cnt += 1
            A_i >>= 1
            if A_i:
                next_A.append(A_i)
        
        ans += b * bit_cnt * (N - bit_cnt)
        ans %= mod
        
        b *= 2
        A = next_A[:]
        
    print(ans)

solve()

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = list(map(int, f_i.readline().split()))
    A_max = max(A)
    
    ans = 0
    b = 1
    while A_max:
        next_A = []
        
        bit_cnt = 0
        
        for A_i in A:
            if A_i & 1:
                bit_cnt += 1
            A_i >>= 1
            if A_i:
                next_A.append(A_i)
        
        ans += b * bit_cnt * (N - bit_cnt)
        ans %= mod
        
        b *= 2
        A_max >>= 1
        A = next_A[:]
        
    print(ans)

solve()

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = list(map(int, f_i.readline().split()))
    A_max = max(A)
    
    ans = 0
    b = 1
    while A_max:
        next_A = []
        
        zero_cnt = 0
        one_cnt = 0
        
        for A_i in A:
            if A_i & 1:
                one_cnt += 1
            else:
                zero_cnt += 1
            next_A.append(A_i >> 1)
        
        ans += b * one_cnt * zero_cnt
        ans %= mod
        
        b *= 2
        A_max >>= 1
        A = next_A[:]
        
    print(ans)

solve()

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from itertools import combinations
    
    mod = 10 ** 9 + 7
    N = int(input())
    A = tuple(map(int, input().split()))
    
    ans = sum(ai ^ aj for ai, aj in combinations(A, 2)) % mod
    
    print(ans)

solve()

Fixed submission:
def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()