import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = in.nextInt();
		}
		selectionSort(c);
		in.close();
	}

	private static void selectionSort(int[] A) {
		int minj;
		int wk;
		int count = 0;
		for (int i = 0; i < A.length; i++) {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < A.length; i++) {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		}
		System.out.println(sb.toString());
		System.out.println(count);
	}

}
 import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = in.nextInt();
		}
		selectionSort(c);
		in.close();
	}

	private static void selectionSort(int[] A) {
		int minj;
		int wk;
		int count = 0;
		for (int i = 0; i < A.length; i++) {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < A.length; i++) {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		}
		System.out.println(sb.toString());
		System.out.println(count);
	}

} Main public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = in.nextInt();
		}
		selectionSort(c);
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = in.nextInt();
		}
		selectionSort(c);
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] c = new int[n]; c new int[n] n for (int i = 0; i < n; i++) {
			c[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			c[i] = in.nextInt();
		} {
			c[i] = in.nextInt();
		} c[i] = in.nextInt() c[i] c i in.nextInt() in.nextInt in selectionSort(c) selectionSort c in.close() in.close in String args[] args private static void selectionSort(int[] A) {
		int minj;
		int wk;
		int count = 0;
		for (int i = 0; i < A.length; i++) {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < A.length; i++) {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		}
		System.out.println(sb.toString());
		System.out.println(count);
	} selectionSort {
		int minj;
		int wk;
		int count = 0;
		for (int i = 0; i < A.length; i++) {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < A.length; i++) {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		}
		System.out.println(sb.toString());
		System.out.println(count);
	} int minj; minj int wk; wk int count = 0; count 0 for (int i = 0; i < A.length; i++) {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		} {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		} minj = i minj i for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			} int j = i; int j = i; j i j < A.length j A.length A A.length j++ j++ j {
				if (A[j] < A[minj]) {

					minj = j;

				}

			} {
				if (A[j] < A[minj]) {

					minj = j;

				}

			} if (A[j] < A[minj]) {

					minj = j;

				} A[j] < A[minj] A[j] A j A[minj] A minj {

					minj = j;

				} minj = j minj j if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			} minj!=i minj i {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			} wk=A[minj] wk A[minj] A minj A[minj]=A[i] A[minj] A minj A[i] A i A[i]=wk A[i] A i wk count+=1 count 1 StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < A.length; i++) {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		} {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		} if (i > 0) {
				sb.append(" ");
			} i > 0 i 0 {
				sb.append(" ");
			} sb.append(" ") sb.append sb " " sb.append(A[i]) sb.append sb A[i] A i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb System.out.println(count) System.out.println System.out System System.out count int[] A A
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = in.nextInt();
		}
		selectionSort(c);
		in.close();
	}

	private static void selectionSort(int[] A) {
		int minj;
		int wk;
		int count = 0;
		for (int i = 0; i < A.length; i++) {
			minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {

					minj = j;

				}

			}
			if(minj!=i) {
				wk=A[minj];
				A[minj]=A[i];
				A[i]=wk;
				count+=1;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < A.length; i++) {
			if (i > 0) {
				sb.append(" ");
			}
			sb.append(A[i]);

		}
		System.out.println(sb.toString());
		System.out.println(count);
	}

}

