def selection_sort(alist):
    """Sort alist by selection sort.
    Returns the sorted list and number of swap operation.

    >>> selection_sort([5, 6, 4, 2, 1, 3])
    ([1, 2, 3, 4, 5, 6], 4)
    """
    size = len(alist)
    c = 0

    for i in range(size):
        mini = i
        for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

        if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

    return (alist, c)


def run():
    _ = int(input()) # flake8: noqa
    nums = [int(i) for i in input().split()]

    (sortednums, count) = selection_sort(nums)

    print(" ".join([str(i) for i in sortednums]))
    print(count)


if __name__ == '__main__':
    run()
 def selection_sort(alist):
    """Sort alist by selection sort.
    Returns the sorted list and number of swap operation.

    >>> selection_sort([5, 6, 4, 2, 1, 3])
    ([1, 2, 3, 4, 5, 6], 4)
    """
    size = len(alist)
    c = 0

    for i in range(size):
        mini = i
        for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

        if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

    return (alist, c) selection_sort """Sort alist by selection sort.
    Returns the sorted list and number of swap operation.

    >>> selection_sort([5, 6, 4, 2, 1, 3])
    ([1, 2, 3, 4, 5, 6], 4)
    """ size = len(alist) size len(alist) len alist c = 0 c 0 for i in range(size):
        mini = i
        for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

        if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

     i range(size) range size mini = i mini i for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

         j range(i, size) range i size if alist[mini] > alist[j]:
                mini = j

         alist[mini] > alist[j] alist[mini] alist mini alist[j] alist j mini = j mini j if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

     i != mini i mini alist[i], alist[mini] = alist[mini], alist[i] alist[i] alist i alist[mini] alist mini alist[mini] alist mini alist[i] alist i c += 1 c 1 return (alist, c) (alist, c) alist c alist alist def run():
    _ = int(input()) # flake8: noqa
    nums = [int(i) for i in input().split()]

    (sortednums, count) = selection_sort(nums)

    print(" ".join([str(i) for i in sortednums]))
    print(count) run _ = int(input()) _ int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i nums = [int(i) for i in input().split()] nums [int(i) for i in input().split()] (sortednums, count) = selection_sort(nums) (sortednums, count) sortednums count selection_sort(nums) selection_sort nums str(i) for i in sortednums for i in sortednums i sortednums for i in sortednums str(i) str i print(" ".join([str(i) for i in sortednums])) print " ".join([str(i) for i in sortednums]) " ".join " " join [str(i) for i in sortednums] print(count) print count if __name__ == '__main__':
    run() __name__ == '__main__' __name__ '__main__' run() run def selection_sort(alist):
    """Sort alist by selection sort.
    Returns the sorted list and number of swap operation.

    >>> selection_sort([5, 6, 4, 2, 1, 3])
    ([1, 2, 3, 4, 5, 6], 4)
    """
    size = len(alist)
    c = 0

    for i in range(size):
        mini = i
        for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

        if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

    return (alist, c) def selection_sort(alist):
    """Sort alist by selection sort.
    Returns the sorted list and number of swap operation.

    >>> selection_sort([5, 6, 4, 2, 1, 3])
    ([1, 2, 3, 4, 5, 6], 4)
    """
    size = len(alist)
    c = 0

    for i in range(size):
        mini = i
        for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

        if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

    return (alist, c) selection_sort def run():
    _ = int(input()) # flake8: noqa
    nums = [int(i) for i in input().split()]

    (sortednums, count) = selection_sort(nums)

    print(" ".join([str(i) for i in sortednums]))
    print(count) def run():
    _ = int(input()) # flake8: noqa
    nums = [int(i) for i in input().split()]

    (sortednums, count) = selection_sort(nums)

    print(" ".join([str(i) for i in sortednums]))
    print(count) run
def selection_sort(alist):
    """Sort alist by selection sort.
    Returns the sorted list and number of swap operation.

    >>> selection_sort([5, 6, 4, 2, 1, 3])
    ([1, 2, 3, 4, 5, 6], 4)
    """
    size = len(alist)
    c = 0

    for i in range(size):
        mini = i
        for j in range(i, size):
            if alist[mini] > alist[j]:
                mini = j

        if i != mini:
            alist[i], alist[mini] = alist[mini], alist[i]
            c += 1

    return (alist, c)


def run():
    _ = int(input()) # flake8: noqa
    nums = [int(i) for i in input().split()]

    (sortednums, count) = selection_sort(nums)

    print(" ".join([str(i) for i in sortednums]))
    print(count)


if __name__ == '__main__':
    run()

