import java.util.Scanner;

public class Main{

	static int c = 0;

	public static void selectionSort(int[] A, int n) {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	}

	public static void printArray(int[] A, int n) {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	}

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

	static int c = 0;

	public static void selectionSort(int[] A, int n) {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	}

	public static void printArray(int[] A, int n) {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	}

} Main static int c = 0; c 0 public static void selectionSort(int[] A, int n) {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	} selectionSort {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	} for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		} {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		} int minj = i; minj i for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if (A[j] < A[minj]) {
					minj = j;
				}
			} {
				if (A[j] < A[minj]) {
					minj = j;
				}
			} if (A[j] < A[minj]) {
					minj = j;
				} A[j] < A[minj] A[j] A j A[minj] A minj {
					minj = j;
				} minj = j minj j if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			} i != minj i minj {
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			} int tmp = A[i]; tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp c++ c int[] A A int n n public static void printArray(int[] A, int n) {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	} printArray {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	} for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		} int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {

			System.out.print(A[i] + " ");
		} {

			System.out.print(A[i] + " ");
		} System.out.print(A[i] + " ") System.out.print System.out System System.out A[i] + " " A[i] A i " " System.out.println(A[n - 1]) System.out.println System.out System System.out A[n - 1] A n - 1 n 1 int[] A A int n n public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	} main {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int A[] = new int[n]; A new int[n] n for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			A[i] = sc.nextInt();
		} {
			A[i] = sc.nextInt();
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc sc.close() sc.close sc selectionSort(A, n) selectionSort A n printArray(A, n) printArray A n System.out.println(c) System.out.println System.out System System.out c String[] args args public class Main{

	static int c = 0;

	public static void selectionSort(int[] A, int n) {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	}

	public static void printArray(int[] A, int n) {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	}

} public class Main{

	static int c = 0;

	public static void selectionSort(int[] A, int n) {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	}

	public static void printArray(int[] A, int n) {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	}

} Main
import java.util.Scanner;

public class Main{

	static int c = 0;

	public static void selectionSort(int[] A, int n) {

		for (int i = 0; i < n; i++) {

			int minj = i;

			for (int j = i; j < n; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}

			if( i != minj ){
				int tmp = A[i];
				A[i] = A[minj];
				A[minj] = tmp;
				c++;
			}
		}
	}

	public static void printArray(int[] A, int n) {

		for (int i = 0; i < n - 1; i++) {

			System.out.print(A[i] + " ");
		}
		System.out.println(A[n - 1]);
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();

		selectionSort(A, n);

		printArray(A, n);

		System.out.println(c);

	}

}

