from typing import List
from typing import Any


def bubblesort(arr: List[Any]) -> int:
    """Bubble Sort algorithm to arrange a list so that the lowest value is
    stored in 0 and the highest value is stored in len(arr)-1.  It is included
    here in order to access the swap count.

    Args:
        arr (list) - object to be sorted

    Returns:
        arr (list) - sorted
        swap_count (int) - number of permutations to achieve the sort
    """
    larr = len(arr)
    swap_count = 0
    for i in range(larr):
        swapped = False
        for j in range(0, larr - i - 1):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]
                swapped = True
                swap_count += 1
        if not swapped:
            break
    return swap_count