Buggy python submission (verdict: Runtime Error):
import sys
import math

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    a_max = max(A)
    a_len = len(A)
    keta = int(math.log2(a_max) + 1)

    t = [[0 for _ in range(keta)] for _ in range(2)]

    for k in range(keta):
        for a in A:
            a = a & (2**k)
            a = a >> k
            t[a][k] += 1

    ans = 0
    for k in range(keta):
        ans += (t[0][k] * t[1][k]) * pow(2, k, mod)
        ans %= mod

    print(ans)


if __name__ == '__main__':
    solve()


Fixed submission:
import sys

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    a_max = max(A)
    a_len = len(A)
    keta = 0

    while True:
        a_max = a_max // 2
        keta += 1
        if a_max == 0:
            break

    # print(keta)
    t = [[0 for _ in range(keta)] for _ in range(2)]

    for k in range(keta):
        for a in A:
            a = a & (2**k)
            a = a >> k
            t[a][k] += 1

    # print(t)

    ans = 0
    for k in range(keta):
        ans += (t[0][k] * t[1][k]) * pow(2, k, mod)
        ans %= mod

    print(ans)


if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Runtime Error):
import sys
import math

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    a_max = max(A)
    a_len = len(A)
    keta = int(math.log2(a_max) + 1)

    t = [[0 for _ in range(keta)] for _ in range(2)]

    for k in range(keta):
        for a in A:
            a = a & (2**k)
            a = a >> k
            t[a][k] += 1

    ans = 0
    for k in range(keta):
        ans += (t[0][k] * t[1][k]) * pow(2, k, mod)
        ans %= mod

    print(ans)


if __name__ == '__main__':
    solve()


Fixed submission:
import sys

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    a_max = max(A)
    a_len = len(A)
    keta = 0

    while True:
        a_max = a_max // 2
        keta += 1
        if a_max == 0:
            break

    # print(keta)
    t = [[0 for _ in range(keta)] for _ in range(2)]

    for k in range(keta):
        for a in A:
            a = a & (2**k)
            a = a >> k
            t[a][k] += 1

    # print(t)

    ans = 0
    for k in range(keta):
        ans += (t[0][k] * t[1][k]) * pow(2, k, mod)
        ans %= mod

    print(ans)


if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Runtime Error):
import sys
import math

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    a_max = max(A)
    a_len = len(A)
    keta = math.ceil(math.log2(a_max))

    t = [[0 for _ in range(keta)] for _ in range(2)]

    for k in range(keta):
        for a in A:
            a = a & (2**k)
            a = a >> k
            t[a][k] += 1

    ans = 0
    for k in range(keta):
        ans += (t[0][k] * t[1][k]) * pow(2, k, mod)
        ans %= mod

    print(ans)


if __name__ == '__main__':
    solve()


Fixed submission:
import sys

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    a_max = max(A)
    a_len = len(A)
    keta = 0

    while True:
        a_max = a_max // 2
        keta += 1
        if a_max == 0:
            break

    # print(keta)
    t = [[0 for _ in range(keta)] for _ in range(2)]

    for k in range(keta):
        for a in A:
            a = a & (2**k)
            a = a >> k
            t[a][k] += 1

    # print(t)

    ans = 0
    for k in range(keta):
        ans += (t[0][k] * t[1][k]) * pow(2, k, mod)
        ans %= mod

    print(ans)


if __name__ == '__main__':
    solve()