def selectionSort(A):
    nSwap = 0
    for i in range(N):
        minIdx = i
        for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
        if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
    return A, nSwap

N = int(input())
A = list(map(int, input().split()))

sortedA, nSwap = selectionSort(A)
print(' '.join(map(str, sortedA)))
print(nSwap) def selectionSort(A):
    nSwap = 0
    for i in range(N):
        minIdx = i
        for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
        if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
    return A, nSwap selectionSort nSwap = 0 nSwap 0 for i in range(N):
        minIdx = i
        for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
        if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
     i range(N) range N minIdx = i minIdx i for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
         j range(i, N) range i N if A[j] < A[minIdx]:
                minIdx = j
         A[j] < A[minIdx] A[j] A j A[minIdx] A minIdx minIdx = j minIdx j if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
     minIdx != i minIdx i A[i], A[minIdx] = A[minIdx], A[i] A[i] A i A[minIdx] A minIdx A[minIdx] A minIdx A[i] A i nSwap += 1 nSwap 1 return A, nSwap return A, nSwap A nSwap A A N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sortedA, nSwap = selectionSort(A) sortedA selectionSort(A) selectionSort A nSwap print(' '.join(map(str, sortedA))) print ' '.join(map(str, sortedA)) ' '.join ' ' join map(str, sortedA) map str sortedA print(nSwap) print nSwap nSwap = selectionSort(A) selectionSort(A) nSwap A = list(map(int, input().split())) list(map(int, input().split())) A def selectionSort(A):
    nSwap = 0
    for i in range(N):
        minIdx = i
        for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
        if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
    return A, nSwap def selectionSort(A):
    nSwap = 0
    for i in range(N):
        minIdx = i
        for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
        if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
    return A, nSwap selectionSort N = int(input()) int(input()) N sortedA, nSwap = selectionSort(A) selectionSort(A) sortedA
def selectionSort(A):
    nSwap = 0
    for i in range(N):
        minIdx = i
        for j in range(i, N):
            if A[j] < A[minIdx]:
                minIdx = j
        if minIdx != i:
            A[i], A[minIdx] = A[minIdx], A[i]
            nSwap += 1
    return A, nSwap

N = int(input())
A = list(map(int, input().split()))

sortedA, nSwap = selectionSort(A)
print(' '.join(map(str, sortedA)))
print(nSwap)