
def SelectionSort(A, N):
    swap_n = 0

    for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

    return swap_n

N = int(input())
A = [int(a) for a in input().split()]

swap_n = SelectionSort(A, N)

print(*A)
print(swap_n) def SelectionSort(A, N):
    swap_n = 0

    for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

    return swap_n SelectionSort swap_n = 0 swap_n 0 for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

     i range(N) range N min_j = i min_j i for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

         j range(i + 1, N) range i + 1 i 1 N if A[j] < A[min_j]:
                min_j = j

         A[j] < A[min_j] A[j] A j A[min_j] A min_j min_j = j min_j j if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

     i != min_j i min_j A[i], A[min_j] = A[min_j], A[i] A[i] A i A[min_j] A min_j A[min_j] A min_j A[i] A i swap_n += 1 swap_n 1 return swap_n swap_n A A N N N = int(input()) N int(input()) int input() input int(a) for a in input().split() for a in input().split() a input().split() ().split () input split for a in input().split() int(a) int a A = [int(a) for a in input().split()] A [int(a) for a in input().split()] swap_n = SelectionSort(A, N) swap_n SelectionSort(A, N) SelectionSort A N print(*A) print *A A print(swap_n) print swap_n def SelectionSort(A, N):
    swap_n = 0

    for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

    return swap_n def SelectionSort(A, N):
    swap_n = 0

    for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

    return swap_n SelectionSort N = int(input()) int(input()) N swap_n = SelectionSort(A, N) SelectionSort(A, N) swap_n A = [int(a) for a in input().split()] [int(a) for a in input().split()] A

def SelectionSort(A, N):
    swap_n = 0

    for i in range(N):
        min_j = i

        for j in range(i + 1, N):
            if A[j] < A[min_j]:
                min_j = j

        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            swap_n += 1

    return swap_n

N = int(input())
A = [int(a) for a in input().split()]

swap_n = SelectionSort(A, N)

print(*A)
print(swap_n)