#coding: UTF-8

import sys
import math

class Algo:
  @staticmethod
  def insertionSort(r, n):
    count = 0
    for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
    for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
    print(count)

N = int(input())
R= list(map(int, input().split()))
Algo.insertionSort(R, N) import sys sys import math math class Algo:
  @staticmethod
  def insertionSort(r, n):
    count = 0
    for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
    for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
    print(count) Algo def insertionSort(r, n):
    count = 0
    for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
    for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
    print(count) insertionSort count = 0 count 0 for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
     i range(0,n) range 0 n minj = i minj i for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
       j range(i,n) range i n if r[j] < r[minj]:
          minj = j
       r[j] < r[minj] r[j] r j r[minj] r minj minj = j minj j if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
     r[i] != r[minj] r[i] r i r[minj] r minj r[i], r[minj] = r[minj], r[i] r[i] r i r[minj] r minj r[minj] r minj r[i] r i count += 1 count 1 for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
     i range(0,n) range 0 n if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
     i == n-1 i n-1 n 1 print(r[i]) print r[i] r i print(r[i], " ", sep="", end="") print r[i] r i " " sep="" sep "" end="" end "" print(count) print count r r n n @staticmethod
   insertionSort staticmethod insertionSort N = int(input()) N int(input()) int input() input R= list(map(int, input().split())) R list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split Algo.insertionSort(R, N) Algo.insertionSort Algo insertionSort R N class Algo:
  @staticmethod
  def insertionSort(r, n):
    count = 0
    for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
    for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
    print(count) class Algo:
  @staticmethod
  def insertionSort(r, n):
    count = 0
    for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
    for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
    print(count) Algo N = int(input()) int(input()) N R= list(map(int, input().split())) list(map(int, input().split())) R
#coding: UTF-8

import sys
import math

class Algo:
  @staticmethod
  def insertionSort(r, n):
    count = 0
    for i in range(0,n):
      minj = i
      for j in range(i,n):
        if r[j] < r[minj]:
          minj = j
      if r[i] != r[minj]:
        r[i], r[minj] = r[minj], r[i]
        count += 1
    
    for i in range(0,n):
      if i == n-1:
        print(r[i])
      else:
        print(r[i], " ", sep="", end="")
    print(count)

N = int(input())
R= list(map(int, input().split()))
Algo.insertionSort(R, N)