import java.util.Scanner;

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

	private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int changeCount = selectionSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(changeCount);
	}

	private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	}
} Main public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int changeCount = selectionSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(changeCount);
	} main {
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int changeCount = selectionSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(changeCount);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int count = scanner.nextInt(); count scanner.nextInt() scanner.nextInt scanner int[] sortList = new int[count]; sortList new int[count] count for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
			sortList[i] = scanner.nextInt();
		} {
			sortList[i] = scanner.nextInt();
		} sortList[i] = scanner.nextInt() sortList[i] sortList i scanner.nextInt() scanner.nextInt scanner int changeCount = selectionSort(sortList, count); changeCount selectionSort(sortList, count) selectionSort sortList count for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		} int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		} {
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		} if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			} i != count - 1 i count - 1 count 1 {
				System.out.print(sortList[i] + " ");
			} System.out.print(sortList[i] + " ") System.out.print System.out System System.out sortList[i] + " " sortList[i] sortList i " " {
				System.out.println(sortList[i]);
			} System.out.println(sortList[i]) System.out.println System.out System System.out sortList[i] sortList i System.out.println(changeCount) System.out.println System.out System System.out changeCount String[] args args private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	} selectionSort {
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	} int swCount = 0; swCount 0 int min; min int temp; temp for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		} int i = 0; int i = 0; i 0 i < count - 1 i count - 1 count 1 i++ i++ i {
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		} {
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		} min = i min i for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			} int j = i; int j = i; j i j < count j count j++ j++ j {
				if(sortList[j] < sortList[min]){
					min = j;
				}
			} {
				if(sortList[j] < sortList[min]){
					min = j;
				}
			} if(sortList[j] < sortList[min]){
					min = j;
				} sortList[j] < sortList[min] sortList[j] sortList j sortList[min] sortList min {
					min = j;
				} min = j min j temp = sortList[i] temp sortList[i] sortList i sortList[i] = sortList[min] sortList[i] sortList i sortList[min] sortList min sortList[min] = temp sortList[min] sortList min temp if(min != i){
				swCount++;
			} min != i min i {
				swCount++;
			} swCount++ swCount return swCount; swCount int[] sortList sortList int count count public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int changeCount = selectionSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(changeCount);
	}

	private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	}
} public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int changeCount = selectionSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(changeCount);
	}

	private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	}
} Main
import java.util.Scanner;

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

	private static int selectionSort(int[] sortList, int count){
		int swCount = 0;
		int min;
		int temp;
		for(int i = 0; i < count - 1; i++){
			min = i;
			for(int j = i; j < count; j++){
				if(sortList[j] < sortList[min]){
					min = j;
				}
			}
			temp = sortList[i];
			sortList[i] = sortList[min];
			sortList[min] = temp;
			if(min != i){
				swCount++;
			}
		}
		return swCount;
	}
}