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

def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1])

def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
        
A_sorted, c = SelectionSort(A, N)

print_list(A_sorted)
print(c) 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 " " def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1]) print_list for a in A[:-1]:
        print ("%d "%a, end="")
     a A[:-1] A :-1 -1 print ("%d "%a, end="") print "%d "%a "%d " a end="" end "" print(A[-1]) print A[-1] A -1 A A def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
         SelectionSort count = 0 count 0 for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
     i range(N) range N minj = i minj i for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
         j range(i, N) range i N if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
     minj != i minj i v = A[i] v A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = v A[minj] A minj v count += 1 count 1 return A, count return A, count A count A A N N A_sorted, c = SelectionSort(A, N) A_sorted SelectionSort(A, N) SelectionSort A N c print_list(A_sorted) print_list A_sorted print(c) print c def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
         def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
         SelectionSort N = int(input()) int(input()) N A = list(map(int, input().split(" "))) list(map(int, input().split(" "))) A def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1]) def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1]) print_list c = SelectionSort(A, N) SelectionSort(A, N) c A_sorted, c = SelectionSort(A, N) SelectionSort(A, N) A_sorted
N = int(input())
A = list(map(int, input().split(" ")))

def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1])

def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
        
A_sorted, c = SelectionSort(A, N)

print_list(A_sorted)
print(c)