def selection_sort(A):
    swap = 0
    for i in range(len(A)):
        minj = i
        for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
    return swap

if __name__=='__main__':
   N=int(input()) 
   A=list(map(int,input().split()))
   swap = selection_sort(A)
   print(*A)
   print(swap) def selection_sort(A):
    swap = 0
    for i in range(len(A)):
        minj = i
        for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
    return swap selection_sort swap = 0 swap 0 for i in range(len(A)):
        minj = i
        for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
     i range(len(A)) range len(A) len A minj = i minj i for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
         j range(i,len(A)) range i len(A) len A 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:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
     minj != i minj i A[i],A[minj] = A[minj],A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i swap += 1 swap 1 return swap swap A A if __name__=='__main__':
   N=int(input()) 
   A=list(map(int,input().split()))
   swap = selection_sort(A)
   print(*A)
   print(swap) __name__=='__main__' __name__ '__main__' 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 swap = selection_sort(A) swap selection_sort(A) selection_sort A print(*A) print *A A print(swap) print swap def selection_sort(A):
    swap = 0
    for i in range(len(A)):
        minj = i
        for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
    return swap def selection_sort(A):
    swap = 0
    for i in range(len(A)):
        minj = i
        for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
    return swap selection_sort swap = selection_sort(A) selection_sort(A) swap N=int(input()) int(input()) N A=list(map(int,input().split())) list(map(int,input().split())) A
def selection_sort(A):
    swap = 0
    for i in range(len(A)):
        minj = i
        for j in range(i,len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i],A[minj] = A[minj],A[i]
            swap += 1
    return swap

if __name__=='__main__':
   N=int(input()) 
   A=list(map(int,input().split()))
   swap = selection_sort(A)
   print(*A)
   print(swap)