import java.util.*;

public class Main {
	public static void main(String[] args) {
		ALDS1_2_B();
	}
        
	public static void ALDS1_2_B() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int countAns = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		}

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

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

		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if(i != n - 1)
				System.out.print(" ");
		}
		System.out.println();
		System.out.println(countAns);
	} ALDS1_2_B {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int countAns = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		}

		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if(i != n - 1)
				System.out.print(" ");
		}
		System.out.println();
		System.out.println(countAns);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n int countAns = 0; countAns 0 for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		} {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		} int minj = i; minj i for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if(a[j] < a[minj]) {
					minj = j;
				}
			} {
				if(a[j] < a[minj]) {
					minj = j;
				}
			} if(a[j] < a[minj]) {
					minj = j;
				} a[j] < a[minj] a[j] a j a[minj] a minj {
					minj = j;
				} minj = j minj j if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			} minj != i minj i {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			} int temp = a[i]; temp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = temp a[minj] a minj temp countAns++ countAns for(int i = 0; i < n; i++) {
			System.out.print(a[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(a[i]);
			if(i != n - 1)
				System.out.print(" ");
		} {
			System.out.print(a[i]);
			if(i != n - 1)
				System.out.print(" ");
		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if(i != n - 1)
				System.out.print(" "); i != n - 1 i n - 1 n 1 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(countAns) System.out.println System.out System System.out countAns public class Main {
	public static void main(String[] args) {
		ALDS1_2_B();
	}
        
	public static void ALDS1_2_B() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int countAns = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		}

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

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

public class Main {
	public static void main(String[] args) {
		ALDS1_2_B();
	}
        
	public static void ALDS1_2_B() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int countAns = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int minj = i;
			for(int j = i; j < n; j++) {
				if(a[j] < a[minj]) {
					minj = j;
				}
			}
			if(minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				countAns++;
			}
		}

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