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

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());

		String[] str = br.readLine().split(" ");
		int[] numList = new int[count];
		for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		}
		Tool.selectionSort(numList, count);
	}
}

class Tool {
	static void selectionSort(int[] numList, int count) {
		StringBuffer sb = new StringBuffer();
		int flag = 0;
//????????¨????¨???°
		for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			}
		sb.append(numList[0]);
		for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		}
		System.out.println(sb.toString() + "\n" + flag);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());

		String[] str = br.readLine().split(" ");
		int[] numList = new int[count];
		for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		}
		Tool.selectionSort(numList, count);
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());

		String[] str = br.readLine().split(" ");
		int[] numList = new int[count];
		for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		}
		Tool.selectionSort(numList, count);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());

		String[] str = br.readLine().split(" ");
		int[] numList = new int[count];
		for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		}
		Tool.selectionSort(numList, count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int count = Integer.parseInt(br.readLine()); count Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] numList = new int[count]; numList new int[count] count for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		} int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
			numList[i] = Integer.parseInt(str[i]);
		} {
			numList[i] = Integer.parseInt(str[i]);
		} numList[i] = Integer.parseInt(str[i]) numList[i] numList i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i Tool.selectionSort(numList, count) Tool.selectionSort Tool numList count String[] args args class Tool {
	static void selectionSort(int[] numList, int count) {
		StringBuffer sb = new StringBuffer();
		int flag = 0;
//????????¨????¨???°
		for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			}
		sb.append(numList[0]);
		for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		}
		System.out.println(sb.toString() + "\n" + flag);
	}
} Tool static void selectionSort(int[] numList, int count) {
		StringBuffer sb = new StringBuffer();
		int flag = 0;
//????????¨????¨???°
		for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			}
		sb.append(numList[0]);
		for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		}
		System.out.println(sb.toString() + "\n" + flag);
	} selectionSort {
		StringBuffer sb = new StringBuffer();
		int flag = 0;
//????????¨????¨???°
		for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			}
		sb.append(numList[0]);
		for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		}
		System.out.println(sb.toString() + "\n" + flag);
	} StringBuffer sb = new StringBuffer(); sb new StringBuffer() int flag = 0; flag 0 for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			} int i = 0; int i = 0; i 0 i < count - 1 i count - 1 count 1 i++ i++ i {
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			} {
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			} int minj = i; minj i for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < count j count j++ j++ j {
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			} {
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			} if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				} numList[j] < numList[minj] numList[j] numList j numList[minj] numList minj {//?????§??????????´¢??????
					minj = j;
				} minj = j minj j if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				} minj != i minj i {//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				} int temp = numList[i]; temp numList[i] numList i numList[i] = numList[minj] numList[i] numList i numList[minj] numList minj numList[minj] = temp numList[minj] numList minj temp flag++ flag sb.append(numList[0]) sb.append sb numList[0] numList 0 for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		} int i = 1; int i = 1; i 1 i < count i count i++ i++ i {
			sb.append(" " + numList[i]);
		} {
			sb.append(" " + numList[i]);
		} sb.append(" " + numList[i]) sb.append sb " " + numList[i] " " numList[i] numList i System.out.println(sb.toString() + "\n" + flag) System.out.println System.out System System.out sb.toString() + "\n" + flag sb.toString() + "\n" + flag sb.toString() sb.toString sb "\n" flag int[] numList numList int count count
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());

		String[] str = br.readLine().split(" ");
		int[] numList = new int[count];
		for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		}
		Tool.selectionSort(numList, count);
	}
}

class Tool {
	static void selectionSort(int[] numList, int count) {
		StringBuffer sb = new StringBuffer();
		int flag = 0;
//????????¨????¨???°
		for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			}
		sb.append(numList[0]);
		for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		}
		System.out.println(sb.toString() + "\n" + flag);
	}
}