import java.util.Scanner;

//implement the selection sort
public class Main {
	//helper functions
	public static void print_arr(int[] arr) {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	}
	
	
	public static int selection_sort(int[] arr) {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	}
	
	
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	}

} import java.util.Scanner; Scanner java.util public class Main {
	//helper functions
	public static void print_arr(int[] arr) {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	}
	
	
	public static int selection_sort(int[] arr) {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	}
	
	
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	}

} Main //helper functions
	public static void print_arr(int[] arr) {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	} print_arr {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	} int i = 0; i 0 while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		} i < arr.length i arr.length arr arr.length {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		} System.out.print(arr[i]) System.out.print System.out System System.out arr[i] arr i if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			} i < arr.length - 1 i arr.length - 1 arr.length arr arr.length 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " {
				System.out.print("\n");
			} System.out.print("\n") System.out.print System.out System System.out "\n" i++ i int[] arr arr public static int selection_sort(int[] arr) {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	} selection_sort {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	} int swap_times = 0; swap_times 0 for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		} int i = 0; int i = 0; i 0 i< arr.length - 1 i arr.length - 1 arr.length arr arr.length 1 i++ i++ i {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		} {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		} int min = i; min i for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			} int j = i+1; int j = i+1; j i+1 i 1 j < arr.length j arr.length arr arr.length j++ j++ j {
				if(arr[min] > arr[j]) {
					min = j;
				}
			} {
				if(arr[min] > arr[j]) {
					min = j;
				}
			} if(arr[min] > arr[j]) {
					min = j;
				} arr[min] > arr[j] arr[min] arr min arr[j] arr j {
					min = j;
				} min = j min j if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			} min != i min i {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			} swap_times++ swap_times int tmp = arr[i]; tmp arr[i] arr i arr[i] = arr[min] arr[i] arr i arr[min] arr min arr[min] = tmp arr[min] arr min tmp return swap_times; swap_times int[] arr arr public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	} main {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	} Scanner cin = new Scanner(System.in); cin new Scanner(System.in) int n = cin.nextInt(); n cin.nextInt() cin.nextInt cin int [] arr = new int[n]; arr new int[n] n for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = cin.nextInt();
		} {
			arr[i] = cin.nextInt();
		} arr[i] = cin.nextInt() arr[i] arr i cin.nextInt() cin.nextInt cin int swap_times = selection_sort(arr); swap_times selection_sort(arr) selection_sort arr print_arr(arr) print_arr arr System.out.println(swap_times) System.out.println System.out System System.out swap_times String[] args args public class Main {
	//helper functions
	public static void print_arr(int[] arr) {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	}
	
	
	public static int selection_sort(int[] arr) {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	}
	
	
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	}

} public class Main {
	//helper functions
	public static void print_arr(int[] arr) {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	}
	
	
	public static int selection_sort(int[] arr) {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	}
	
	
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	}

} Main
import java.util.Scanner;

//implement the selection sort
public class Main {
	//helper functions
	public static void print_arr(int[] arr) {
		int i = 0;
		while(i < arr.length) {
			System.out.print(arr[i]);
			if(i < arr.length - 1) {
				System.out.print(" ");
			}else {
				System.out.print("\n");
			}
			i++;
		}
	}
	
	
	public static int selection_sort(int[] arr) {
		int swap_times = 0;
		for(int i = 0; i< arr.length - 1; i++) {
			//choose the smallest element from a[i:];
			int min = i;
			for(int j = i+1; j < arr.length; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			
			if(min != i) {
				swap_times++;
				//do swap
				int tmp = arr[i];
				arr[i] = arr[min];
				arr[min] = tmp;
			}
		}
		return swap_times;
	}
	
	
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int [] arr = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = cin.nextInt();
		}
		
		int swap_times = selection_sort(arr);
		print_arr(arr);
		System.out.println(swap_times);
		
		
	}

}