def count_inversion_bf(arr: list[int]) -> int:
    """
    Menghitung jumlah inversi menggunakan algoritma brute force
    >>> count_inversion_bf([1, 4, 2, 4, 1])
    4
    """
    num_inversion = 0
    n = len(arr)

    for i in range(n - 1):
        for j in range(i + 1, n):
            if arr[i] > arr[j]:
                num_inversion += 1
    return num_inversion