import java.util.Scanner;
	public class Main {
	private static Scanner scanner;
	public static void main(String args[]) {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	}
	}
 import java.util.Scanner; Scanner java.util public class Main {
	private static Scanner scanner;
	public static void main(String args[]) {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	}
	} Main private static Scanner scanner; scanner public static void main(String args[]) {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	} main {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	} scanner = new Scanner(System.in) scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int[] b = new int[a]; b new int[a] a int minj minj count = 0; count 0 for(int i=0;i < a;i++) b[i] = scanner.nextInt(); int i=0; int i=0; i 0 i < a i a i++ i++ i b[i] = scanner.nextInt(); b[i] = scanner.nextInt() b[i] b i scanner.nextInt() scanner.nextInt scanner for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		} {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		} minj = i minj i for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < a j a j++ j++ j {
				if(b[j] < b[minj]) {
					minj = j;
				}
			} {
				if(b[j] < b[minj]) {
					minj = j;
				}
			} if(b[j] < b[minj]) {
					minj = j;
				} b[j] < b[minj] b[j] b j b[minj] b minj {
					minj = j;
				} minj = j minj j if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				} minj != i minj i {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				} int tmp = b[i]; tmp b[i] b i b[i] = b[minj] b[i] b i b[minj] b minj b[minj] = tmp b[minj] b minj tmp count++ count for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		} int i=0; int i=0; i 0 i < a i a i++ i++ i {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		} {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		} System.out.print(b[i]) System.out.print System.out System System.out b[i] b i if(i == a-1) System.out.println("");
			else System.out.print(" "); i == a-1 i a-1 a 1 System.out.println("") System.out.println System.out System System.out "" System.out.print(" ") System.out.print System.out System System.out " " System.out.println(count) System.out.println System.out System System.out count String args[] args public class Main {
	private static Scanner scanner;
	public static void main(String args[]) {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	}
	} public class Main {
	private static Scanner scanner;
	public static void main(String args[]) {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	}
	} Main
import java.util.Scanner;
	public class Main {
	private static Scanner scanner;
	public static void main(String args[]) {

		scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		int minj,count = 0;
		for(int i=0;i < a;i++) b[i] = scanner.nextInt();

		for(int i = 0;i < a;i++) {
			minj = i;
			for(int j = i;j < a;j++) {
				if(b[j] < b[minj]) {
					minj = j;
				}
			}
				if(minj != i) {
					int tmp = b[i];
					b[i] = b[minj];
					b[minj] = tmp;
					count++;
				}
		}
		for(int i=0;i < a;i++) {
			System.out.print(b[i]);
			if(i == a-1) System.out.println("");
			else System.out.print(" ");
		}
		System.out.println(count);
	}
	}

