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


public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	}
	
	private static void selectionSort(int[] array, int num) {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	}
	
	private static void selectionSort(int[] array, int num) {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	} main {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	} BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) int num = Integer.parseInt(bf.readLine()); num Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf int[] array = new int[num]; array new int[num] num String[] arrayString = bf.readLine().split(" "); arrayString bf.readLine().split(" ") bf.readLine().split bf.readLine() bf.readLine bf " " for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		} int i=0; int i=0; i 0 i<num i num i++ i++ i {
			array[i]=Integer.parseInt(arrayString[i]);
		} {
			array[i]=Integer.parseInt(arrayString[i]);
		} array[i]=Integer.parseInt(arrayString[i]) array[i] array i Integer.parseInt(arrayString[i]) Integer.parseInt Integer arrayString[i] arrayString i selectionSort(array,num) selectionSort array num String[] args args private static void selectionSort(int[] array, int num) {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	} selectionSort {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	} int count=0; count 0 for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		} int i=0; int i=0; i 0 i<num i num i++ i++ i {
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		} {
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		} int min=i; min i for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			} int j=i; int j=i; j i j<num j num j++ j++ j {
				if(array[j]<array[min]){
					min=j;
				}
			} {
				if(array[j]<array[min]){
					min=j;
				}
			} if(array[j]<array[min]){
					min=j;
				} array[j]<array[min] array[j] array j array[min] array min {
					min=j;
				} min=j min j if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			} min!=i min i {
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			} int tmp=array[i]; tmp array[i] array i array[i]=array[min] array[i] array i array[min] array min array[min]=tmp array[min] array min tmp count++ count for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		} int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		} {
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		} System.out.printf("%d",array[i]) System.out.printf System.out System System.out "%d" array[i] array i if(i!=array.length-1){
				System.out.printf(" ");
			} i!=array.length-1 i array.length-1 array.length array array.length 1 {
				System.out.printf(" ");
			} System.out.printf(" ") System.out.printf System.out System System.out " " System.out.println("") System.out.println System.out System System.out "" System.out.println(count) System.out.println System.out System System.out count int[] array array int num num public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	}
	
	private static void selectionSort(int[] array, int num) {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	}
	
	private static void selectionSort(int[] array, int num) {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????°
		int num = Integer.parseInt(bf.readLine());
		
		//??????????´?
		int[] array = new int[num];
		
		//?????????
		String[] arrayString = bf.readLine().split(" ");
		
		for(int i=0;i<num;i++){
			array[i]=Integer.parseInt(arrayString[i]);
		}		
		selectionSort(array,num);
	}
	
	private static void selectionSort(int[] array, int num) {
		int count=0;
		for(int i=0;i<num;i++){
			int min=i;
			for(int j=i;j<num;j++){
				if(array[j]<array[min]){
					min=j;
				}
			}
			if(min!=i){
			int tmp=array[i];
			array[i]=array[min];
			array[min]=tmp;
			count++;
			}
		}
		
		for(int i=0;i<array.length;i++){
			System.out.printf("%d",array[i]);
			if(i!=array.length-1){
				System.out.printf(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	}
}