import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	}

	public static void selectionSort(List<Integer> list) {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	}

	public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	}
}
 import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	}

	public static void selectionSort(List<Integer> list) {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	}

	public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	} main {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			list.add(scan.nextInt());
		} {
			list.add(scan.nextInt());
		} list.add(scan.nextInt()) list.add list scan.nextInt() scan.nextInt scan selectionSort(list) selectionSort list String[] args args public static void selectionSort(List<Integer> list) {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	} selectionSort {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	} int tail = -1; tail -1 1 int count = 0; count 0 while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		} tail < list.size() - 1 tail list.size() - 1 list.size() list.size list 1 {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		} int min = list.get(tail + 1); min list.get(tail + 1) list.get list tail + 1 tail 1 int minIdx = tail + 1; minIdx tail + 1 tail 1 for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			} int i = minIdx + 1; int i = minIdx + 1; i minIdx + 1 minIdx 1 i < list.size() i list.size() list.size list i++ i++ i {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			} {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			} if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				} min > list.get(i) min list.get(i) list.get list i {
					min = list.get(i);
					minIdx = i;
				} min = list.get(i) min list.get(i) list.get list i minIdx = i minIdx i if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			} list.get(tail + 1) > min list.get(tail + 1) list.get list tail + 1 tail 1 min {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			} list.set(minIdx, list.get(tail + 1)) list.set list minIdx list.get(tail + 1) list.get list tail + 1 tail 1 list.set(tail + 1, min) list.set list tail + 1 tail 1 min count++ count tail++ tail showList(list) showList list System.out.println(count) System.out.println System.out System System.out count List<Integer> list list public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	} showList {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	} for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		} int i = 0; int i = 0; i 0 i < list.size() - 1 i list.size() - 1 list.size() list.size list 1 i++ i++ i {
			System.out.print(list.get(i));
			System.out.print(" ");
		} {
			System.out.print(list.get(i));
			System.out.print(" ");
		} System.out.print(list.get(i)) System.out.print System.out System System.out list.get(i) list.get list i System.out.print(" ") System.out.print System.out System System.out " " System.out.println(list.get(list.size() - 1)) System.out.println System.out System System.out list.get(list.size() - 1) list.get list list.size() - 1 list.size() list.size list 1 List<Integer> list list public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	}

	public static void selectionSort(List<Integer> list) {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	}

	public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	}

	public static void selectionSort(List<Integer> list) {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	}

	public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			list.add(scan.nextInt());
		}
		selectionSort(list);
	}

	public static void selectionSort(List<Integer> list) {
		int tail = -1;
		int count = 0;
		while (tail < list.size() - 1) {
			int min = list.get(tail + 1);
			int minIdx = tail + 1;
			for (int i = minIdx + 1; i < list.size(); i++) {
				if (min > list.get(i)) {
					min = list.get(i);
					minIdx = i;
				}
			}
			if (list.get(tail + 1) > min) {
				list.set(minIdx, list.get(tail + 1));
				list.set(tail + 1, min);
				count++;
			}
			tail++;
		}
		showList(list);
		System.out.println(count);
	}

	public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	}
}

