import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	}

	public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	}

	public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	}

	public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	}

	public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	} main {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	} BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) int n = readInt(r); n readInt(r) readInt r String[] numArrayStr = r.readLine().split(" "); numArrayStr r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " int[] numArrayInt = convertToInt(numArrayStr); numArrayInt convertToInt(numArrayStr) convertToInt numArrayStr selectSort(numArrayInt) selectSort numArrayInt String[] args args public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	} selectSort {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	} int count = 0; count 0 for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		} int i = 0; int i = 0; i 0 i < numArrayInt.length i numArrayInt.length numArrayInt numArrayInt.length i++ i++ i {
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		} {
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		} int miny = i; miny i for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			} int y = i; int y = i; y i y < numArrayInt.length y numArrayInt.length numArrayInt numArrayInt.length y++ y++ y {
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			} {
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			} if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				} numArrayInt[y] < numArrayInt[miny] numArrayInt[y] numArrayInt y numArrayInt[miny] numArrayInt miny {
					miny = y;
				} miny = y miny y if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			} miny != i miny i {
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			} int temp = numArrayInt[i]; temp numArrayInt[i] numArrayInt i numArrayInt[i] = numArrayInt[miny] numArrayInt[i] numArrayInt i numArrayInt[miny] numArrayInt miny numArrayInt[miny] = temp numArrayInt[miny] numArrayInt miny temp count++ count printBlank(numArrayInt) printBlank numArrayInt System.out.println(count) System.out.println System.out System System.out count int[] numArrayInt numArrayInt public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    } readInt {
        return Integer.parseInt(r.readLine());
    } return Integer.parseInt(r.readLine()); Integer.parseInt(r.readLine()) Integer.parseInt Integer r.readLine() r.readLine r BufferedReader r r public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	} convertToInt {
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	} int[] numArrayInt = new int[numArrayStr.length]; numArrayInt new int[numArrayStr.length] numArrayStr.length numArrayStr numArrayStr.length for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		} int i = 0; int i = 0; i 0 i < numArrayStr.length i numArrayStr.length numArrayStr numArrayStr.length i++ i++ i {
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		} {
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		} numArrayInt[i] = Integer.parseInt(numArrayStr[i]) numArrayInt[i] numArrayInt i Integer.parseInt(numArrayStr[i]) Integer.parseInt Integer numArrayStr[i] numArrayStr i return numArrayInt; numArrayInt String[] numArrayStr numArrayStr public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	} printBlank {
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	} StringBuilder builder = new StringBuilder(); builder new StringBuilder() for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		} int i = 0; int i = 0; i 0 i < numArrayInt.length i numArrayInt.length numArrayInt numArrayInt.length i++ i++ i {
			builder.append(numArrayInt[i]);
			builder.append(" ");
		} {
			builder.append(numArrayInt[i]);
			builder.append(" ");
		} builder.append(numArrayInt[i]) builder.append builder numArrayInt[i] numArrayInt i builder.append(" ") builder.append builder " " System.out.println(builder.toString().trim()) System.out.println System.out System System.out builder.toString().trim() builder.toString().trim builder.toString() builder.toString builder int[] numArrayInt numArrayInt public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	}

	public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	}

	public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	}

	public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	}

	public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	}

	public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	}

	public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}
}