

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	}

	public static void selectionSrot(int[] A, int N) {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	}

	public static void selectionSrot(int[] A, int N) {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	} 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 < N; i++) {
			A[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan selectionSrot(A, N) selectionSrot A N scan.close() scan.close scan String[] args args public static void selectionSrot(int[] A, int N) {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	} selectionSrot {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	} int count = 0; count 0 for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		} int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		} {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		} int initialA = A[i]; initialA A[i] A i int minIndex = i; minIndex i for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < A.length j A.length A A.length j++ j++ j {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			} {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			} if (A[minIndex] > A[j]) {
					minIndex = j;
				} A[minIndex] > A[j] A[minIndex] A minIndex A[j] A j {
					minIndex = j;
				} minIndex = j minIndex j int temp = A[i]; temp A[i] A i A[i] = A[minIndex] A[i] A i A[minIndex] A minIndex A[minIndex] = temp A[minIndex] A minIndex temp if (initialA != A[i]) {
				count++;
			} initialA != A[i] initialA A[i] A i {
				count++;
			} count++ count String output = Arrays.toString(A).replaceAll(",", ""); output Arrays.toString(A).replaceAll(",", "") Arrays.toString(A).replaceAll Arrays.toString(A) Arrays.toString Arrays A "," "" System.out.println(output.substring(1, output.length() - 1)) System.out.println System.out System System.out output.substring(1, output.length() - 1) output.substring output 1 output.length() - 1 output.length() output.length output 1 System.out.println(count) System.out.println System.out System System.out count int[] A A int N N public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	}

	public static void selectionSrot(int[] A, int N) {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	}

	public static void selectionSrot(int[] A, int N) {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	}
} Main


import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		selectionSrot(A, N);
		scan.close();
	}

	public static void selectionSrot(int[] A, int N) {
		// ???????????°
		int count = 0;
		
		for (int i = 0; i < N - 1; i++) {
			// ???????????????????????????????????\??¨
			int initialA = A[i];
			int minIndex = i;
			for (int j = i + 1; j < A.length; j++) {
				if (A[minIndex] > A[j]) {
					minIndex = j;
				}
			}
			// ????°??????????????????????????????¨??????
			int temp = A[i];
			A[i] = A[minIndex];
			A[minIndex] = temp;
			// ???????????????????????§??????
			if (initialA != A[i]) {
				count++;
			}

		}
		
		String output = Arrays.toString(A).replaceAll(",", "");
		System.out.println(output.substring(1, output.length() - 1));
		System.out.println(count);
	}
}