def selectionSort(A, N):
    swapnum= 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 1
    return swapnum
def showlist(A):
    for i in range(len(A)):
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')
N = eval(input())
A = list(map(int, input().split()))
swapnum = selectionSort(A, N)
showlist(A)
print(swapnum) def selectionSort(A, N):
    swapnum= 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 1
    return swapnum selectionSort swapnum= 0 swapnum 0 for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 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 i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 1
     i!=minj i minj temp = A[i] temp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = temp A[minj] A minj temp swapnum += 1 swapnum 1 return swapnum swapnum A A N N def showlist(A):
    for i in range(len(A)):
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ') showlist for i in range(len(A)):
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ') i range(len(A)) range len(A) len A if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ') i==len(A)-1 i len(A)-1 len(A) len A 1 print(A[i]) print A[i] A i print(A[i], end=' ') print A[i] A i end=' ' end ' ' A A N = eval(input()) N eval(input()) eval 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 swapnum = selectionSort(A, N) swapnum selectionSort(A, N) selectionSort A N showlist(A) showlist A print(swapnum) print swapnum N = eval(input()) eval(input()) N A = list(map(int, input().split())) list(map(int, input().split())) A def selectionSort(A, N):
    swapnum= 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 1
    return swapnum def selectionSort(A, N):
    swapnum= 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 1
    return swapnum selectionSort swapnum = selectionSort(A, N) selectionSort(A, N) swapnum def showlist(A):
    for i in range(len(A)):
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ') def showlist(A):
    for i in range(len(A)):
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ') showlist
def selectionSort(A, N):
    swapnum= 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i!=minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            swapnum += 1
    return swapnum
def showlist(A):
    for i in range(len(A)):
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')
N = eval(input())
A = list(map(int, input().split()))
swapnum = selectionSort(A, N)
showlist(A)
print(swapnum)
