import java.util.*;

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

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

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

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

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

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

		for (int i=0; i<n; i++) {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		}
		System.out.println();
		System.out.println(count);
	} main {
		int n = sc.nextInt();
		int[] ints = new int[n];
		for (int i=0; i<n; i++) {
			ints[i] = sc.nextInt();
		}

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

		for (int i=0; i<n; i++) {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		}
		System.out.println();
		System.out.println(count);
	} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ints = new int[n]; ints new int[n] n for (int i=0; i<n; i++) {
			ints[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			ints[i] = sc.nextInt();
		} {
			ints[i] = sc.nextInt();
		} ints[i] = sc.nextInt() ints[i] ints i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		} {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		} int minj = i; minj i boolean flag = false; flag false for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			} int j=i; int j=i; j i j<n j n j++ j++ j {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			} {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			} if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				} ints[j] < ints[minj] ints[j] ints j ints[minj] ints minj {
					minj = j;
					flag = true;
				} minj = j minj j flag = true flag true if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			} flag==true flag true {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			} int temp = ints[i]; temp ints[i] ints i ints[i] = ints[minj] ints[i] ints i ints[minj] ints minj ints[minj] = temp ints[minj] ints minj temp count++ count for (int i=0; i<n; i++) {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		} {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		} System.out.print(ints[i]) System.out.print System.out System System.out ints[i] ints i if (i!=n-1) {System.out.print(" ");} i!=n-1 i n-1 n 1 {System.out.print(" ");} System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] ints = new int[n];
		for (int i=0; i<n; i++) {
			ints[i] = sc.nextInt();
		}

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

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

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

		for (int i=0; i<n; i++) {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		}
		System.out.println();
		System.out.println(count);
	}
} Main
import java.util.*;

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

		int count = 0;
		for (int i=0; i<n; i++) {
			int minj = i;
			boolean flag = false;
			for (int j=i; j<n; j++) {
				if (ints[j] < ints[minj]) {
					minj = j;
					flag = true;
				}
			}
			if (flag==true) {
				int temp = ints[i];
				ints[i] = ints[minj];
				ints[minj] = temp;
				count++;
			}
		}

		for (int i=0; i<n; i++) {
			System.out.print(ints[i]);
			if (i!=n-1) {System.out.print(" ");}
		}
		System.out.println();
		System.out.println(count);
	}
}			
