import java.io.IOException;
import java.util.Scanner;

/**
 * 選択ソート
 * 
 *
 */

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	}
	
	public static void selectionSort(int[] arr, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	}
	
	public static void selectionSort(int[] arr, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} Main public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	} main {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = s.nextInt();
		} {
			arr[i] = s.nextInt();
		} arr[i] = s.nextInt() arr[i] arr i s.nextInt() s.nextInt s selectionSort(arr, n) selectionSort arr n String[] args args public static void selectionSort(int[] arr, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	} selectionSort {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	} int count = 0; count 0 for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		} {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		} int minj = i; minj i for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			} {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			} if (arr[j] < arr[minj]) {
					minj = j;
				} arr[j] < arr[minj] arr[j] arr j arr[minj] arr minj {
					minj = j;
				} minj = j minj j if (i != minj) {
				count++;
			} i != minj i minj {
				count++;
			} count++ count int tmp = arr[i]; tmp arr[i] arr i arr[i] = arr[minj] arr[i] arr i arr[minj] arr minj arr[minj] = tmp arr[minj] arr minj tmp printArray(arr) printArray arr System.out.println(count) System.out.println System.out System System.out count int[] arr arr int n n public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	} printArray {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	} String ans = ""; ans "" for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			ans += arr[i] + " ";
		} {
			ans += arr[i] + " ";
		} ans += arr[i] + " " ans arr[i] + " " arr[i] arr i " " System.out.println(ans.trim()) System.out.println System.out System System.out ans.trim() ans.trim ans int[] arr arr public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	}
	
	public static void selectionSort(int[] arr, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	}
	
	public static void selectionSort(int[] arr, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} Main
import java.io.IOException;
import java.util.Scanner;

/**
 * 選択ソート
 * 
 *
 */

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		selectionSort(arr, n);
		
	}
	
	public static void selectionSort(int[] arr, int n) {
		int count = 0;
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (arr[j] < arr[minj]) {
					minj = j;
				}
			}
			if (i != minj) {
				count++;
			}
			int tmp = arr[i];
			arr[i] = arr[minj];
			arr[minj] = tmp;
		}
		printArray(arr);
		System.out.println(count);
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
}
