import java.util.Scanner
import scala.collection.mutable

object Main extends App {

  val sc = new Scanner(System.in)

  def nextInt() = sc.next.toInt

  val n = nextInt
  val seq = mutable.Seq.fill(n)(nextInt)

  var cnt = 0

  for (i <- 0 until seq.length) {
    var minj = i

    for (j <- i until seq.length)
      if (seq(j) < seq(minj))
        minj = j

    if (minj != i) {
      val tmp = seq(i)
      seq(i) = seq(minj)
      seq(minj) = tmp
      cnt += 1
    }
  }

  println(seq mkString " ")
  println(cnt)
}

