def selection_sort(numbers, n):
    """selection sort method

    Args:
        numbers: a list of numbers to be sorted
        n: len(numbers)

    Returns:
        sorted numberd, number of swapped times
    """
    counter = 0
    for i in range(0, n - 1):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
    return numbers, counter


length = int(raw_input())
numbers = [int(x) for x in raw_input().split()]

numbers, number_of_swapped_times = selection_sort(numbers, length)
print(" ".join([str(x) for x in numbers]))
print(number_of_swapped_times) def selection_sort(numbers, n):
    """selection sort method

    Args:
        numbers: a list of numbers to be sorted
        n: len(numbers)

    Returns:
        sorted numberd, number of swapped times
    """
    counter = 0
    for i in range(0, n - 1):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
    return numbers, counter selection_sort """selection sort method

    Args:
        numbers: a list of numbers to be sorted
        n: len(numbers)

    Returns:
        sorted numberd, number of swapped times
    """ counter = 0 counter 0 for i in range(0, n - 1):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
     i range(0, n - 1) range 0 n - 1 n 1 min_j = i min_j i for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
         j range(i + 1, n) range i + 1 i 1 n if numbers[j] < numbers[min_j]:
                min_j = j
         numbers[j] < numbers[min_j] numbers[j] numbers j numbers[min_j] numbers min_j min_j = j min_j j if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
     min_j != i min_j i numbers[min_j], numbers[i] = numbers[i], numbers[min_j] numbers[min_j] numbers min_j numbers[i] numbers i numbers[i] numbers i numbers[min_j] numbers min_j counter += 1 counter 1 return numbers, counter return numbers, counter numbers counter numbers numbers n n length = int(raw_input()) length int(raw_input()) int raw_input() raw_input int(x) for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() int(x) int x numbers = [int(x) for x in raw_input().split()] numbers [int(x) for x in raw_input().split()] numbers, number_of_swapped_times = selection_sort(numbers, length) numbers selection_sort(numbers, length) selection_sort numbers length number_of_swapped_times str(x) for x in numbers for x in numbers x numbers for x in numbers str(x) str x print(" ".join([str(x) for x in numbers])) print " ".join([str(x) for x in numbers]) " ".join " " join [str(x) for x in numbers] print(number_of_swapped_times) print number_of_swapped_times numbers, number_of_swapped_times = selection_sort(numbers, length) selection_sort(numbers, length) numbers numbers = [int(x) for x in raw_input().split()] [int(x) for x in raw_input().split()] numbers def selection_sort(numbers, n):
    """selection sort method

    Args:
        numbers: a list of numbers to be sorted
        n: len(numbers)

    Returns:
        sorted numberd, number of swapped times
    """
    counter = 0
    for i in range(0, n - 1):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
    return numbers, counter def selection_sort(numbers, n):
    """selection sort method

    Args:
        numbers: a list of numbers to be sorted
        n: len(numbers)

    Returns:
        sorted numberd, number of swapped times
    """
    counter = 0
    for i in range(0, n - 1):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
    return numbers, counter selection_sort number_of_swapped_times = selection_sort(numbers, length) selection_sort(numbers, length) number_of_swapped_times length = int(raw_input()) int(raw_input()) length
def selection_sort(numbers, n):
    """selection sort method

    Args:
        numbers: a list of numbers to be sorted
        n: len(numbers)

    Returns:
        sorted numberd, number of swapped times
    """
    counter = 0
    for i in range(0, n - 1):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            numbers[min_j], numbers[i] = numbers[i], numbers[min_j]
            counter += 1
    return numbers, counter


length = int(raw_input())
numbers = [int(x) for x in raw_input().split()]

numbers, number_of_swapped_times = selection_sort(numbers, length)
print(" ".join([str(x) for x in numbers]))
print(number_of_swapped_times)