import java.util.Scanner;

public class Main {
	
	int count = 0;
	
	void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	}
	
	void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}
 import java.util.Scanner; Scanner java.util public class Main {
	
	int count = 0;
	
	void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	}
	
	void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} Main int count = 0; count 0 void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	} swap {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	} int tmp = A[a]; tmp A[a] A a A[a] = A[b] A[a] A a A[b] A b A[b] = tmp A[b] A b tmp count++ count int[] A A int a a int b b void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	} selectionSort {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	} for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		} {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		} int minj = i; minj i for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < A.length j A.length A A.length 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 (minj != i) swap(A, i, minj); minj != i minj i swap(A, i, minj) swap A i minj int[] A A void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	} run {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] A = new int[n]; A new int[n] n for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan count = 0 count 0 selectionSort(A) selectionSort A System.out.print(A[0]) System.out.print System.out System System.out A[0] A 0 for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		} int i = 1; int i = 1; i 1 i < A.length i A.length A A.length 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() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	} main {
		// TODO Auto-generated method stub
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	
	int count = 0;
	
	void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	}
	
	void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} public class Main {
	
	int count = 0;
	
	void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	}
	
	void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} Main
import java.util.Scanner;

public class Main {
	
	int count = 0;
	
	void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	}
	
	void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}

