object Main{
  def main(args: Array[String]){
    val in = new java.util.Scanner(System.in)
    val a = in.nextInt
    var count = 0;
 
    var arr = new Array[Int](a)
    for(i <- 0 to a-1){
      arr(i) = in.nextInt
    }
 
    for(i <- 0 to a-2){
      var minpos = i;
      var minval = arr(i);
 
      for(j <- i+1 to a-1){
        if(arr(j) < minval){
          minpos = j;
          minval = arr(j)
        }
      }
 
      if(minpos != i){
        var tmp = arr(minpos)
        arr(minpos) = arr(i)
        arr(i) = tmp
        count = count + 1
      }
    }
 
    println(arr.mkString(" "))
    println(count)
  }
}