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

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

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String args[]) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	}
} Main public static void main(String args[]) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String ns = br.readLine(); ns br.readLine() br.readLine br int n = Integer.parseInt(ns); n Integer.parseInt(ns) Integer.parseInt Integer ns String as = br.readLine(); as br.readLine() br.readLine br String[] as_ary = as.split(" "); as_ary as.split(" ") as.split as " " int[] a_ary = new int[n]; a_ary new int[n] n for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		} {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		} a_ary[i] = Integer.parseInt(as_ary[i]) a_ary[i] a_ary i Integer.parseInt(as_ary[i]) Integer.parseInt Integer as_ary[i] as_ary i int minj; minj int min; min int count = 0; count 0 for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		} {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		} minj = i minj i for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			} {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			} if (a_ary[j] < a_ary[minj]) {
					minj = j;
				} a_ary[j] < a_ary[minj] a_ary[j] a_ary j a_ary[minj] a_ary minj {
					minj = j;
				} minj = j minj j if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			} i != minj i minj {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			} count += 1 count 1 min = a_ary[minj] min a_ary[minj] a_ary minj a_ary[minj] = a_ary[i] a_ary[minj] a_ary minj a_ary[i] a_ary i a_ary[i] = min a_ary[i] a_ary i min for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		} {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		} System.out.printf(a_ary[i] + (i != n - 1 ? " ": "")) System.out.printf System.out System System.out a_ary[i] + (i != n - 1 ? " ": "") a_ary[i] a_ary i (i != n - 1 ? " ": "") i != n - 1 i n - 1 n 1 " " "" System.out.println("\n"+count) System.out.println System.out System System.out "\n"+count "\n" count String args[] args public class Main {
	public static void main(String args[]) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	}
} public class Main {
	public static void main(String args[]) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	}
}
