#ALDS1_2-B Sort 1 - Selection Sort
def selectionSort(A,N):
    c=0
    for i in range(N):
        minj = i
        j=i
        while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
        if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
    return c

N=int(input())
A=input().split()
c=selectionSort(A,N)
S=""
for i in range(N-1):
    S+=A[i]+" "
S+=str(A[-1])
print(S)
print(c) def selectionSort(A,N):
    c=0
    for i in range(N):
        minj = i
        j=i
        while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
        if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
    return c selectionSort c=0 c 0 for i in range(N):
        minj = i
        j=i
        while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
        if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
     i range(N) range N minj = i minj i j=i j i while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
         j<N j N if(int(A[j])<int(A[minj])):
                minj = j
             int(A[j])<int(A[minj]) int(A[j]) int A[j] A j int(A[minj]) int A[minj] A minj minj = j minj j j+=1 j 1 if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
     i!=minj i minj A[i],A[minj]=A[minj],A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i c+=1 c 1 return c c A A N N N=int(input()) N int(input()) int input() input A=input().split() A input().split() ().split () input split c=selectionSort(A,N) c selectionSort(A,N) selectionSort A N S="" S "" for i in range(N-1):
    S+=A[i]+" " i range(N-1) range N-1 N 1 S+=A[i]+" " S A[i]+" " A[i] A i " " S+=str(A[-1]) S str(A[-1]) str A[-1] A -1 print(S) print S print(c) print c S="" "" S S+=str(A[-1]) str(A[-1]) S N=int(input()) int(input()) N S+=A[i]+" " A[i]+" " S def selectionSort(A,N):
    c=0
    for i in range(N):
        minj = i
        j=i
        while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
        if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
    return c def selectionSort(A,N):
    c=0
    for i in range(N):
        minj = i
        j=i
        while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
        if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
    return c selectionSort A=input().split() input().split() A c=selectionSort(A,N) selectionSort(A,N) c
#ALDS1_2-B Sort 1 - Selection Sort
def selectionSort(A,N):
    c=0
    for i in range(N):
        minj = i
        j=i
        while j<N:
            if(int(A[j])<int(A[minj])):
                minj = j
            j+=1
        if(i!=minj):
            A[i],A[minj]=A[minj],A[i]
            c+=1
    return c

N=int(input())
A=input().split()
c=selectionSort(A,N)
S=""
for i in range(N-1):
    S+=A[i]+" "
S+=str(A[-1])
print(S)
print(c)