import java.util.*;
import java.io.*;
public class Main {
	static int n = 0;
	
	public static void selection_sort(int[] a) {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	}
	
	public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	}
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
	static int n = 0;
	
	public static void selection_sort(int[] a) {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	}
	
	public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	}
} Main static int n = 0; n 0 public static void selection_sort(int[] a) {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	} selection_sort {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	} int swapCount = 0; swapCount 0 for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		} {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		} int min_index = i; min_index i for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				} int j = i+1; int j = i+1; j i+1 i 1 j < n j n j++ j++ j {
					if (a[j] < a[min_index])
						min_index = j;
				} {
					if (a[j] < a[min_index])
						min_index = j;
				} if (a[j] < a[min_index])
						min_index = j; a[j] < a[min_index] a[j] a j a[min_index] a min_index min_index = j min_index j int tmp = a[min_index]; tmp a[min_index] a min_index a[min_index] = a[i] a[min_index] a min_index a[i] a i a[i] = tmp a[i] a i tmp if (min_index != i) swapCount++; min_index != i min_index i swapCount++ swapCount if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]); i < n-1 i n-1 n 1 System.out.print(a[i] + " ") System.out.print System.out System System.out a[i] + " " a[i] a i " " System.out.println(a[i]) System.out.println System.out System System.out a[i] a i System.out.println(swapCount) System.out.println System.out System System.out swapCount int[] a a public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	} main {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	} @SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = sc.nextInt(); a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc selection_sort(a) selection_sort a String args[] args public class Main {
	static int n = 0;
	
	public static void selection_sort(int[] a) {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	}
	
	public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	}
} public class Main {
	static int n = 0;
	
	public static void selection_sort(int[] a) {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	}
	
	public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	}
} Main
import java.util.*;
import java.io.*;
public class Main {
	static int n = 0;
	
	public static void selection_sort(int[] a) {
		
		// init swap count
		int swapCount = 0;
		
		// start from left to right
		for (int i = 0; i < n; i++) {
			
			// find the ith minimum element
			
				// assume that a[i] is the minimum value
				int min_index = i;
				
				// search for values that are smaller than minimum value
				for (int j = i+1; j < n; j++) {
					if (a[j] < a[min_index])
						min_index = j;
				}
				
			// put that element in the right place (ith position) & increase swapCount
			int tmp = a[min_index];
			a[min_index] = a[i];
			a[i] = tmp;
			
			if (min_index != i) swapCount++;
				
			// print sorted elements
			if (i < n-1) System.out.print(a[i] + " "); 
			else
				System.out.println(a[i]);
		}
		System.out.println(swapCount);
	}
	
	public static void main (String args[]) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) 
			a[i] = sc.nextInt();
		selection_sort(a);
	}
}