import scala.io.StdIn.{readInt,readLine}

object Main {
  def selectionSort(a:Array[Int]):Int = {
    var cnt = 0
    for(i <- 0 until a.length) {
      var mini = i
      for(j <- i until a.length) if(a(j) < a(mini)) mini = j

      val t = a(i)
      a(i) = a(mini)
      a(mini) = t
      if(i!=mini) cnt += 1
    }
    cnt
  }

  def main(args:Array[String]) = {
    val n = readInt
    val a = readLine.split(" ").map(_.toInt)
    val cnt = selectionSort(a)

    println(a.mkString(" "))
    println(cnt)
  }
}