import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	}
	public static int  selectionSort(int[] nums){
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	}
	public static void printArray(int[] nums){
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	}

} import java.util.*; util.* java public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	}
	public static int  selectionSort(int[] nums){
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	}
	public static void printArray(int[] nums){
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	}

} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	} main {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = sc.nextInt(); count sc.nextInt() sc.nextInt sc int[] nums = new int[count]; nums new int[count] count for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<count i count i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc int swap = selectionSort(nums); swap selectionSort(nums) selectionSort nums printArray(nums) printArray nums System.out.println(swap) System.out.println System.out System System.out swap String args[] args public static int  selectionSort(int[] nums){
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	} selectionSort {
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	} int swap = 0; swap 0 for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		} int i=0; int i=0; i 0 i<nums.length i nums.length nums nums.length i++ i++ i {
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		} {
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		} int min = i; min i for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			} int j=i+1; int j=i+1; j i+1 i 1 j<nums.length j nums.length nums nums.length j++ j++ j {
				if(nums[j]<nums[min]) min=j;
			} {
				if(nums[j]<nums[min]) min=j;
			} if(nums[j]<nums[min]) min=j; nums[j]<nums[min] nums[j] nums j nums[min] nums min min=j min j if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			} min!=i min i {
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			} int tmp = nums[i]; tmp nums[i] nums i nums[i] = nums[min] nums[i] nums i nums[min] nums min nums[min] = tmp nums[min] nums min tmp swap++ swap return swap; swap int[] nums nums public static void printArray(int[] nums){
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	} printArray {
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	} for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		} int i=0; int i=0; i 0 i<nums.length i nums.length nums nums.length i++ i++ i {
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		} {
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		} if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]); i!=0 i 0 System.out.print(" "+nums[i]) System.out.print System.out System System.out " "+nums[i] " " nums[i] nums i System.out.print(nums[i]) System.out.print System.out System System.out nums[i] nums i System.out.println() System.out.println System.out System System.out int[] nums nums public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	}
	public static int  selectionSort(int[] nums){
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	}
	public static void printArray(int[] nums){
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	}

} public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	}
	public static int  selectionSort(int[] nums){
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	}
	public static void printArray(int[] nums){
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	}

} Main
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt(); 
		int[] nums = new int[count];
		for(int i=0;i<count;i++){
			nums[i] = sc.nextInt();
		}
		int swap = selectionSort(nums);
		printArray(nums);
		System.out.println(swap);
		
	}
	public static int  selectionSort(int[] nums){
		int swap = 0;
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i+1;j<nums.length;j++){
				if(nums[j]<nums[min]) min=j;
			}
			if(min!=i){
				int tmp = nums[i];
				nums[i] = nums[min];
				nums[min] = tmp;
				swap++;
			}
		}		
		return swap; 
		
		
	}
	public static void printArray(int[] nums){
		for(int i=0;i<nums.length;i++){
			if(i!=0)System.out.print(" "+nums[i]);
			else System.out.print(nums[i]);
		}
		System.out.println();
	}

}