import java.util.Scanner;

public class Main { //InsertionSort

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	}
}
 import java.util.Scanner; Scanner java.util public class Main { //InsertionSort

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr = new int[n]; arr new int[n] n for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = sc.nextInt();
		} {
			arr[i] = sc.nextInt();
		} arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		} {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		} int min = i; min i for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if(arr[min] > arr[j]) {
					min = j;
				}
			} {
				if(arr[min] > arr[j]) {
					min = j;
				}
			} if(arr[min] > arr[j]) {
					min = j;
				} arr[min] > arr[j] arr[min] arr min arr[j] arr j {
					min = j;
				} min = j min j if(i != min) {
				count++;
			} i != min i min {
				count++;
			} count++ count int v = arr[min]; v arr[min] arr min arr[min] = arr[i] arr[min] arr min arr[i] arr i arr[i] = v arr[i] arr i v for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		} {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		} if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			} i == n - 1 i n - 1 n 1 {
				System.out.println(arr[i]);
			} System.out.println(arr[i]) System.out.println System.out System System.out arr[i] arr i {
				System.out.print(arr[i] + " ");
			} System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main { //InsertionSort

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	}
} public class Main { //InsertionSort

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	}
} Main
import java.util.Scanner;

public class Main { //InsertionSort

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++) {
			int min = i;
			for(int j = i; j < n; j++) {
				if(arr[min] > arr[j]) {
					min = j;
				}
			}
			if(i != min) {
				count++;
			}
			int v = arr[min];
			arr[min] = arr[i];
			arr[i] = v;
		}
		for(int i = 0; i < n; i++) {
			if(i == n - 1) {
				System.out.println(arr[i]);
			} else {
				System.out.print(arr[i] + " ");
			}
		}
		System.out.println(count);
	}
}

