import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 }
} Main public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 } main {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int A[] = new int[n]; A new int[n] n for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				A[i] = scanner.nextInt();
			} {
				A[i] = scanner.nextInt();
			} A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int changeCount = 0; changeCount 0 for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			} {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			} int minIndex = i; minIndex i for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				} int j = i; int j = i; j i j < A.length j A.length A A.length j++ j++ j {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				} {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				} if(A[minIndex] > A[j]) {
						minIndex = j;
					} A[minIndex] > A[j] A[minIndex] A minIndex A[j] A j {
						minIndex = j;
					} minIndex = j minIndex j if(minIndex == i) continue; minIndex == i minIndex i continue; int tmp = A[i]; tmp A[i] A i A[i] = A[minIndex] A[i] A i A[minIndex] A minIndex A[minIndex] = tmp A[minIndex] A minIndex tmp changeCount++ changeCount System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", "")) System.out.println System.out System System.out Arrays.toString(A).replaceAll("[,\\[\\]]", "") Arrays.toString(A).replaceAll Arrays.toString(A) Arrays.toString Arrays A "[,\\[\\]]" "" System.out.println(changeCount) System.out.println System.out System System.out changeCount String[] args args public class Main {

	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 }
} public class Main {

	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			int n = scanner.nextInt();
			int A[] = new int[n];
			for(int i = 0; i < n; i++) {
				A[i] = scanner.nextInt();
			}

			scanner.close();
			int changeCount = 0;

			//選択ソート
			for(int i = 0; i < A.length; i++) {
				int minIndex = i;
				for(int j = i; j < A.length; j++) {
					if(A[minIndex] > A[j]) {
						minIndex = j;
					}
				}
			//最小値が変わっていなければ値交換はしなくてよい
			if(minIndex == i) continue;
			//値交換
			int tmp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = tmp;
			changeCount++;
			}
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
			System.out.println(changeCount);
	 }
}
