import java.util.Scanner;

public class Main {

	// private static int count = 0;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	}

	/**
	 * セレクションソート。一番小さい値を選択して入れ替える。
	 * 
	 * @param A配列
	 * @param N配列の数
	 * @return入れ替えた回数
	 */
	public static int selectionSort(int[] A, int N) {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	// private static int count = 0;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	}

	/**
	 * セレクションソート。一番小さい値を選択して入れ替える。
	 * 
	 * @param A配列
	 * @param N配列の数
	 * @return入れ替えた回数
	 */
	public static int selectionSort(int[] A, int N) {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan int[] sort_before = new int[num]; sort_before new int[num] num for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			sort_before[i] = scan.nextInt();
		} {
			sort_before[i] = scan.nextInt();
		} sort_before[i] = scan.nextInt() sort_before[i] sort_before i scan.nextInt() scan.nextInt scan int count = selectionSort(sort_before, num); count selectionSort(sort_before, num) selectionSort sort_before num System.out.print(sort_before[0]) System.out.print System.out System System.out sort_before[0] sort_before 0 for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		} int i = 1; int i = 1; i 1 i < num i num i++ i++ i {
			System.out.print(" " + sort_before[i]);
		} {
			System.out.print(" " + sort_before[i]);
		} System.out.print(" " + sort_before[i]) System.out.print System.out System System.out " " + sort_before[i] " " sort_before[i] sort_before i System.out.println() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count scan.close() scan.close scan String[] args args /**
	 * セレクションソート。一番小さい値を選択して入れ替える。
	 * 
	 * @param A配列
	 * @param N配列の数
	 * @return入れ替えた回数
	 */
	public static int selectionSort(int[] A, int N) {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	} selectionSort {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	} int count = 0; count 0 for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		} {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		} int mini = i; mini i for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			} int j = i; int j = i; j i j < N j N j++ j++ j {
				if (A[j] < A[mini]) {
					mini = j;
				}
			} {
				if (A[j] < A[mini]) {
					mini = j;
				}
			} if (A[j] < A[mini]) {
					mini = j;
				} A[j] < A[mini] A[j] A j A[mini] A mini {
					mini = j;
				} mini = j mini j if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			} mini != i mini i {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			} int tmp; tmp tmp = A[i] tmp A[i] A i A[i] = A[mini] A[i] A i A[mini] A mini A[mini] = tmp A[mini] A mini tmp count++ count return count; count int[] A A int N N public class Main {

	// private static int count = 0;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	}

	/**
	 * セレクションソート。一番小さい値を選択して入れ替える。
	 * 
	 * @param A配列
	 * @param N配列の数
	 * @return入れ替えた回数
	 */
	public static int selectionSort(int[] A, int N) {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	}
} public class Main {

	// private static int count = 0;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	}

	/**
	 * セレクションソート。一番小さい値を選択して入れ替える。
	 * 
	 * @param A配列
	 * @param N配列の数
	 * @return入れ替えた回数
	 */
	public static int selectionSort(int[] A, int N) {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	}
} Main
import java.util.Scanner;

public class Main {

	// private static int count = 0;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int[] sort_before = new int[num];

		for (int i = 0; i < num; i++) {
			sort_before[i] = scan.nextInt();
		}

		// selectionSortを実行した回数
		int count = selectionSort(sort_before, num);

		System.out.print(sort_before[0]);
		for (int i = 1; i < num; i++) {
			System.out.print(" " + sort_before[i]);
		}
		System.out.println();
		System.out.println(count);

		scan.close();

	}

	/**
	 * セレクションソート。一番小さい値を選択して入れ替える。
	 * 
	 * @param A配列
	 * @param N配列の数
	 * @return入れ替えた回数
	 */
	public static int selectionSort(int[] A, int N) {

		int count = 0;
		for (int i = 0; i < N; i++) {
			int mini = i;
			for (int j = i; j < N; j++) {
				if (A[j] < A[mini]) {
					mini = j;
				}
			}
			if (mini != i) {
				int tmp;
				tmp = A[i];
				A[i] = A[mini];
				A[mini] = tmp;
				count++;
			}

		}

		return count;
	}
}

