def selection(A,n):
  count = 0
  for i in range(0,n-1):
    min = i
    for j in range(i,n):
      if(A[j] < A[min]):
        min = j
    if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
  printList(A)
  print(count)

def printList(A):
  print(" ".join(str(x) for x in A))

n = int(input())
A = [int(x) for x in input().split()]
selection(A,n) def selection(A,n):
  count = 0
  for i in range(0,n-1):
    min = i
    for j in range(i,n):
      if(A[j] < A[min]):
        min = j
    if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
  printList(A)
  print(count) selection count = 0 count 0 for i in range(0,n-1):
    min = i
    for j in range(i,n):
      if(A[j] < A[min]):
        min = j
    if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
   i range(0,n-1) range 0 n-1 n 1 min = i min i for j in range(i,n):
      if(A[j] < A[min]):
        min = j
     j range(i,n) range i n if(A[j] < A[min]):
        min = j
     A[j] < A[min] A[j] A j A[min] A min min = j min j if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
   min!=i min i A[i], A[min] = A[min], A[i] A[i] A i A[min] A min A[min] A min A[i] A i count+=1 count 1 printList(A) printList A print(count) print count A A n n def printList(A):
  print(" ".join(str(x) for x in A)) printList print(" ".join(str(x) for x in A)) print " ".join(str(x) for x in A) " ".join " " join str(x) str x A A n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A = [int(x) for x in input().split()] A [int(x) for x in input().split()] selection(A,n) selection A n def printList(A):
  print(" ".join(str(x) for x in A)) def printList(A):
  print(" ".join(str(x) for x in A)) printList n = int(input()) int(input()) n def selection(A,n):
  count = 0
  for i in range(0,n-1):
    min = i
    for j in range(i,n):
      if(A[j] < A[min]):
        min = j
    if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
  printList(A)
  print(count) def selection(A,n):
  count = 0
  for i in range(0,n-1):
    min = i
    for j in range(i,n):
      if(A[j] < A[min]):
        min = j
    if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
  printList(A)
  print(count) selection A = [int(x) for x in input().split()] [int(x) for x in input().split()] A
def selection(A,n):
  count = 0
  for i in range(0,n-1):
    min = i
    for j in range(i,n):
      if(A[j] < A[min]):
        min = j
    if(min!=i):
      A[i], A[min] = A[min], A[i]
      count+=1
  printList(A)
  print(count)

def printList(A):
  print(" ".join(str(x) for x in A))

n = int(input())
A = [int(x) for x in input().split()]
selection(A,n)