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
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            count +=1
    return A,count

N = int(input())
A = list(map(int,input().split()))
A,count = selectionSort(A,N)
print(" ".join(map(str,A)))
print("%d"%(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
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            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
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            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 A[i],A[minj] = A[minj],A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i if i != minj:
            count +=1
     i != minj i minj count +=1 count 1 return A,count return A,count A count A A N N 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 A,count = selectionSort(A,N) A selectionSort(A,N) selectionSort A N count print(" ".join(map(str,A))) print " ".join(map(str,A)) " ".join " " join map(str,A) map str A print("%d"%(count)) print "%d"%(count) "%d" 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
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            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
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            count +=1
    return A,count selectionSort A,count = selectionSort(A,N) selectionSort(A,N) A count = selectionSort(A,N) selectionSort(A,N) count A = list(map(int,input().split())) list(map(int,input().split())) A N = int(input()) int(input()) N
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
        A[i],A[minj] = A[minj],A[i]
        if i != minj:
            count +=1
    return A,count

N = int(input())
A = list(map(int,input().split()))
A,count = selectionSort(A,N)
print(" ".join(map(str,A)))
print("%d"%(count))

