
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   int n = Integer.parseInt( br.readLine() );
   String[] string=  br.readLine().split(" ");
   int [] Progression = new int[n];


   for(int i = 0; i < n ; i++){
       Progression[i] = Integer.parseInt(string[i] );
   }

   int min;
   int tmp;
   int flag = 0;
   int changecount = 0;

   for(int i = 0; i < n;i++){
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   }

   for(int k = 0;k < n; k++){
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }

   System.out.println(changecount);

 }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   int n = Integer.parseInt( br.readLine() );
   String[] string=  br.readLine().split(" ");
   int [] Progression = new int[n];


   for(int i = 0; i < n ; i++){
       Progression[i] = Integer.parseInt(string[i] );
   }

   int min;
   int tmp;
   int flag = 0;
   int changecount = 0;

   for(int i = 0; i < n;i++){
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   }

   for(int k = 0;k < n; k++){
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }

   System.out.println(changecount);

 }
} Main public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   int n = Integer.parseInt( br.readLine() );
   String[] string=  br.readLine().split(" ");
   int [] Progression = new int[n];


   for(int i = 0; i < n ; i++){
       Progression[i] = Integer.parseInt(string[i] );
   }

   int min;
   int tmp;
   int flag = 0;
   int changecount = 0;

   for(int i = 0; i < n;i++){
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   }

   for(int k = 0;k < n; k++){
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }

   System.out.println(changecount);

 } main {
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   int n = Integer.parseInt( br.readLine() );
   String[] string=  br.readLine().split(" ");
   int [] Progression = new int[n];


   for(int i = 0; i < n ; i++){
       Progression[i] = Integer.parseInt(string[i] );
   }

   int min;
   int tmp;
   int flag = 0;
   int changecount = 0;

   for(int i = 0; i < n;i++){
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   }

   for(int k = 0;k < n; k++){
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }

   System.out.println(changecount);

 } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt( br.readLine() ); n Integer.parseInt( br.readLine() ) Integer.parseInt Integer br.readLine() br.readLine br String[] string=  br.readLine().split(" "); string br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int [] Progression = new int[n]; Progression new int[n] n for(int i = 0; i < n ; i++){
       Progression[i] = Integer.parseInt(string[i] );
   } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
       Progression[i] = Integer.parseInt(string[i] );
   } {
       Progression[i] = Integer.parseInt(string[i] );
   } Progression[i] = Integer.parseInt(string[i] ) Progression[i] Progression i Integer.parseInt(string[i] ) Integer.parseInt Integer string[i] string i int min; min int tmp; tmp int flag = 0; flag 0 int changecount = 0; changecount 0 for(int i = 0; i < n;i++){
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   } {
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   } min = i min i for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       } int j = i; int j = i; j i j < n j n j++ j++ j {
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       } {
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       } flag = 0 flag 0 if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   } Progression[j] < Progression[min] Progression[j] Progression j Progression[min] Progression min {
    		   min = j;
    		   flag = 1;
    	   } min = j min j flag = 1 flag 1 tmp = Progression[i] tmp Progression[i] Progression i Progression[i] = Progression[min] Progression[i] Progression i Progression[min] Progression min Progression[min] = tmp Progression[min] Progression min tmp if(tmp != Progression[i]){
    	   changecount++;
       } tmp != Progression[i] tmp Progression[i] Progression i {
    	   changecount++;
       } changecount++ changecount for(int k = 0;k < n; k++){
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   } {
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   } System.out.print( Progression[k] ) System.out.print System.out System System.out Progression[k] Progression k if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   } k < n-1 k n-1 n 1 {
		   System.out.print(" ");
	   } System.out.print(" ") System.out.print System.out System System.out " " {
		   System.out.println();
	   } System.out.println() System.out.println System.out System System.out System.out.println(changecount) System.out.println System.out System System.out changecount String args[] args

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   int n = Integer.parseInt( br.readLine() );
   String[] string=  br.readLine().split(" ");
   int [] Progression = new int[n];


   for(int i = 0; i < n ; i++){
       Progression[i] = Integer.parseInt(string[i] );
   }

   int min;
   int tmp;
   int flag = 0;
   int changecount = 0;

   for(int i = 0; i < n;i++){
	   min = i;
       for(int j = i; j < n; j++){
    	   flag = 0;
    	   if( Progression[j] < Progression[min] ){
    		   min = j;
    		   flag = 1;
    	   }

       }


       tmp = Progression[i];
       Progression[i] = Progression[min];
       Progression[min] = tmp;

       if(tmp != Progression[i]){
    	   changecount++;
       }

   }

   for(int k = 0;k < n; k++){
	   System.out.print( Progression[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }

   System.out.println(changecount);

 }
}