object Main extends App {
  import java.{ util => ju }
  import scala.annotation._
  import scala.collection._
  import scala.collection.{ mutable => mu }
  import scala.collection.JavaConverters._
  import scala.math._
  import scala.io.StdIn.readLine

  val sc = new ju.Scanner(System.in)

  val n = sc.nextInt()
  var nums = Array.fill(n)(sc.nextInt())

  var swapCount = 0
  for (i <- 0 until n) {
    var min = i
    for (j <- i to n - 1) {
      if (nums(j) < nums(min)) {
        min = j
      }
    }
    if (min != i) {
      val bigger = nums(min)
      nums(min) = nums(i)
      nums(i) = bigger
      swapCount += 1
    }
  }

  printArray(nums)
  println(swapCount)

  def printArray(nums: Array[Int]) {
    for (i <- 0 until nums.length - 1) print(nums(i) + " ")
    println(nums.last)
  }
}