object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)

    val n = scanner.nextInt
    val a = Array.fill(n)(scanner.nextInt)

    var c, minj = 0
    for(i <- 0 until n) {
      minj = i
      for(j <- i until n) {
        if(a(j) < a(minj)) {
          minj = j
        }
      }
      if(i != minj) {
        val t = a(i)
        a(i) = a(minj)
        a(minj) = t
        c = c + 1
      }
    }
    println(a.mkString(" "))
    println(c)
  }
}

