import java.util.Scanner

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val r = mutable.ArrayBuffer.fill(n)(sc.nextInt())

    var count = 0

    (0 until n).foreach { i =>
      var minj = i
      (i until n).foreach { j =>
        if (r(minj) > r(j)) minj = j
      }

      if (i != minj) {
        val ri = r(i)
        val rj = r(minj)
        r(i) = rj
        r(minj) = ri
        count += 1
      }
    }

    println(r.mkString(" "))
    println(count)

  }

}

