from typing import List


def bubble_sort(arr: List[int]) -> int:
    """Bubble sort a list inplace and return the amount of swaps."""
    swaps = 0
    for _ in range(len(arr)):
        for i in range(len(arr) - 1):
            if arr[i] > arr[i + 1]:
                arr[i], arr[i + 1] = arr[i + 1], arr[i]
                swaps += 1
    return swaps