import sys

def selectionSort(x_list, y):
  a = 0
  for i in range(y):
    minj = i
    for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
    x_list[i], x_list[minj] = x_list[minj], x_list[i]
    if x_list[i] != x_list[minj]:
      a += 1
  return a

y = sys.stdin.readline()
y = int(y)
 
x = sys.stdin.readline()
x_list = x.split(" ")
 
for i in range(y):
  x_list[i] = int(x_list[i])
 
a = selectionSort(x_list, y)
 
for k in range(0, y):
  print x_list[k],
print
print a import sys sys def selectionSort(x_list, y):
  a = 0
  for i in range(y):
    minj = i
    for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
    x_list[i], x_list[minj] = x_list[minj], x_list[i]
    if x_list[i] != x_list[minj]:
      a += 1
  return a selectionSort a = 0 a 0 for i in range(y):
    minj = i
    for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
    x_list[i], x_list[minj] = x_list[minj], x_list[i]
    if x_list[i] != x_list[minj]:
      a += 1
   i range(y) range y minj = i minj i for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
     j range(i, y) range i y if x_list[j] < x_list[minj]:
        minj = j
     x_list[j] < x_list[minj] x_list[j] x_list j x_list[minj] x_list minj minj = j minj j x_list[i], x_list[minj] = x_list[minj], x_list[i] x_list[i] x_list i x_list[minj] x_list minj x_list[minj] x_list minj x_list[i] x_list i if x_list[i] != x_list[minj]:
      a += 1
   x_list[i] != x_list[minj] x_list[i] x_list i x_list[minj] x_list minj a += 1 a 1 return a a x_list x_list y y y = sys.stdin.readline() y sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline y = int(y) y int(y) int y x = sys.stdin.readline() x sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline x_list = x.split(" ") x_list x.split(" ") x.split x split " " for i in range(y):
  x_list[i] = int(x_list[i])
  i range(y) range y x_list[i] = int(x_list[i]) x_list[i] x_list i int(x_list[i]) int x_list[i] x_list i a = selectionSort(x_list, y) a selectionSort(x_list, y) selectionSort x_list y for k in range(0, y):
  print x_list[k], k range(0, y) range 0 y print x_list[k] x_list k print print y = int(y) int(y) y a = selectionSort(x_list, y) selectionSort(x_list, y) a x = sys.stdin.readline() sys.stdin.readline() x def selectionSort(x_list, y):
  a = 0
  for i in range(y):
    minj = i
    for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
    x_list[i], x_list[minj] = x_list[minj], x_list[i]
    if x_list[i] != x_list[minj]:
      a += 1
  return a def selectionSort(x_list, y):
  a = 0
  for i in range(y):
    minj = i
    for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
    x_list[i], x_list[minj] = x_list[minj], x_list[i]
    if x_list[i] != x_list[minj]:
      a += 1
  return a selectionSort y = sys.stdin.readline() sys.stdin.readline() y x_list = x.split(" ") x.split(" ") x_list
import sys

def selectionSort(x_list, y):
  a = 0
  for i in range(y):
    minj = i
    for j in range(i, y):
      if x_list[j] < x_list[minj]:
        minj = j
    x_list[i], x_list[minj] = x_list[minj], x_list[i]
    if x_list[i] != x_list[minj]:
      a += 1
  return a

y = sys.stdin.readline()
y = int(y)
 
x = sys.stdin.readline()
x_list = x.split(" ")
 
for i in range(y):
  x_list[i] = int(x_list[i])
 
a = selectionSort(x_list, y)
 
for k in range(0, y):
  print x_list[k],
print
print a