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

public class Main {

	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	}

} Main private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	} print {
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	} String[] V=new String[A.length]; V new String[A.length] A.length A A.length for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		} int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
			V[i]=String.valueOf(A[i]);
		} {
			V[i]=String.valueOf(A[i]);
		} V[i]=String.valueOf(A[i]) V[i] V i String.valueOf(A[i]) String.valueOf String A[i] A i System.out.println(String.join(" ",V)) System.out.println System.out System System.out String.join(" ",V) String.join String " " V int[] A A public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	} selectionSort { // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	} int store=0; store 0 for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		} int i =0; int i =0; i 0 i< A.length i A.length A A.length i++ i++ i {
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		} {
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		} int mini = i; mini i for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			} int j = i; int j = i; j i j< A.length j A.length A A.length j++ j++ j {
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			} {
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			} if(A[j] < A[mini]){
					 mini = j;
				 } A[j] < A[mini] A[j] A j A[mini] A mini {
					 mini = j;
				 } mini = j mini j if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			} mini!=i mini i {
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			} store++ store int w=A[i]; w A[i] A i A[i]=A[mini] A[i] A i A[mini] A mini A[mini]=w A[mini] A mini w print(A) print A System.out.println(store) System.out.println System.out System System.out store int[] A A public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	} main {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	} try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        } {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line; line while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            } (line = br.readLine()) != null (line = br.readLine()) line br.readLine() br.readLine br null {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            } int[] A=new int[Integer.parseInt(line)]; A new int[Integer.parseInt(line)] Integer.parseInt(line) Integer.parseInt Integer line line=br.readLine() line br.readLine() br.readLine br String[] str=line.split(" "); str line.split(" ") line.split line " " for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	} int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
            		A[i]=Integer.parseInt(str[i]);
            	} {
            		A[i]=Integer.parseInt(str[i]);
            	} A[i]=Integer.parseInt(str[i]) A[i] A i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i selectionSort(A) selectionSort A break; String[] args args public class Main {

	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	}

} public class Main {

	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void selectionSort(int[] A){ // N??????????´??????????0-?????????????????????
		int store=0;
		for(int i =0;i< A.length;i++){
			int mini = i;
			for(int j = i;j< A.length;j++){
				 if(A[j] < A[mini]){
					 mini = j;
				 }
			}
			if(mini!=i){
				store++;
				int w=A[i];
				A[i]=A[mini];
				A[mini]=w;
			}
		}
		print(A);
		System.out.println(store);
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	selectionSort(A);
            	break;
            }
        }
	}

}