import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		}
		
		selectionSort(array, num);
		
		scanner.close();
	}

	public static void selectionSort( int[] numArray, int num){
		int count = 0;
		
		//選択ソート
		for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		}
		//出力
		for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		}
		
		selectionSort(array, num);
		
		scanner.close();
	}

	public static void selectionSort( int[] numArray, int num){
		int count = 0;
		
		//選択ソート
		for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		}
		//出力
		for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.println(count);
	}
} Main public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		}
		
		selectionSort(array, num);
		
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		}
		
		selectionSort(array, num);
		
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int  num = scanner.nextInt(); num scanner.nextInt() scanner.nextInt scanner int array[] = new int[num]; array new int[num] num for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < num i num i ++ i ++ i {
			array[i] = scanner.nextInt();
		} {
			array[i] = scanner.nextInt();
		} array[i] = scanner.nextInt() array[i] array i scanner.nextInt() scanner.nextInt scanner selectionSort(array, num) selectionSort array num scanner.close() scanner.close scanner String args[] args public static void selectionSort( int[] numArray, int num){
		int count = 0;
		
		//選択ソート
		for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		}
		//出力
		for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.println(count);
	} selectionSort {
		int count = 0;
		
		//選択ソート
		for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		}
		//出力
		for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.println(count);
	} int count = 0; count 0 for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		} int i = 0; int i = 0; i 0 i < num - 1 i num - 1 num 1 i++ i++ i {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		} {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		} int comp = i; comp i for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < num j num j++ j++ j {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			} {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			} if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				} numArray[comp] > numArray[j] numArray[comp] numArray comp numArray[j] numArray j {
					// 最少値設定
					comp = j;
				} comp = j comp j if (i == comp) {
				continue;
			} i == comp i comp {
				continue;
			} continue; int sub = numArray[i]; sub numArray[i] numArray i numArray[i] = numArray[comp] numArray[i] numArray i numArray[comp] numArray comp numArray[comp] = sub numArray[comp] numArray comp sub count++ count for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		} int i = 0; int i = 0; i 0 i < num i num i ++ i ++ i {
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		} {
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		} System.out.print(numArray[i]) System.out.print System.out System System.out numArray[i] numArray i if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			} i == num - 1 i num - 1 num 1 {
			System.out.print("\n");
			} System.out.print("\n") System.out.print System.out System System.out "\n" {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println(count) System.out.println System.out System System.out count int[] numArray numArray int num num
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  num = scanner.nextInt();//要素数
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] = scanner.nextInt();
		}
		
		selectionSort(array, num);
		
		scanner.close();
	}

	public static void selectionSort( int[] numArray, int num){
		int count = 0;
		
		//選択ソート
		for (int i = 0; i < num - 1; i++) {
			// 比較元の配列番号をセットする
			int comp = i;
			// 最小値の探索
			for (int j = i + 1; j < num; j++) {
				if (numArray[comp] > numArray[j]) {
					// 最少値設定
					comp = j;
				}
			}
			// 最小値が入れ替わっていなければ数値を入れ替えない
			if (i == comp) {
				continue;
			}
			//入れ替え処理
			int sub = numArray[i];
			numArray[i] = numArray[comp];
			numArray[comp] = sub;
			count++;		//入れ替えたので足しこむ
		}
		//出力
		for(int i = 0; i < num; i ++ ){
			System.out.print(numArray[i]);
			if( i == num - 1) {
			System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.println(count);
	}
}
