import java.util.*;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	} main {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] ar = new int[N]; ar new int[N] N int cnt = 0; cnt 0 for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			ar[i] = sc.nextInt();
		} {
			ar[i] = sc.nextInt();
		} ar[i] = sc.nextInt() ar[i] ar i sc.nextInt() sc.nextInt sc for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		} {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		} boolean swapFlag = false; swapFlag false int minIndex = i; minIndex i for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			} int j = i + 1,min = ar[minIndex]; int j = i + 1 j i + 1 i 1 min = ar[minIndex]; min ar[minIndex] ar minIndex j < N j N j++ j++ j {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			} {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			} if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				} ar[j] < min ar[j] ar j min {
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				} min = ar[j] min ar[j] ar j minIndex = j minIndex j swapFlag = true swapFlag true if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			} swapFlag {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			} int temp = ar[i]; temp ar[i] ar i ar[i] = ar[minIndex] ar[i] ar i ar[minIndex] ar minIndex ar[minIndex] = temp ar[minIndex] ar minIndex temp cnt++ cnt for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	} {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	} System.out.print(ar[i]) System.out.print System.out System System.out ar[i] ar i if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		} i + 1 < N i + 1 i 1 N {
			System.out.print(" ");
		} System.out.print(" ") System.out.print System.out System System.out " " {
			System.out.println();
		} System.out.println() System.out.println System.out System System.out System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] ar = new int[N];
		int cnt = 0;
		
		for (int i = 0; i < N; i++) {
			ar[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			boolean swapFlag = false;
			int minIndex = i;
			for (int j = i + 1,min = ar[minIndex]; j < N; j++) {
				if ( ar[j] < min ){
					min = ar[j];
					minIndex = j;
					swapFlag = true;
				}
			}
			if (swapFlag) {
				int temp = ar[i];
				ar[i] = ar[minIndex];
				ar[minIndex] = temp;
				cnt++;
			}
		}
	
	for (int i = 0; i < N; i++) {
		System.out.print(ar[i]);
		if (i + 1 < N) {
			System.out.print(" ");
		} else {
			System.out.println();
		}
	}
	
	System.out.println(cnt);
	}
}