

import java.util.Scanner;

public class Main {
	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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	}
} Main 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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	} 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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	} 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 int cnt = 0; cnt 0 for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		} int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		} {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		} int minID = i; minID i for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			} int j = i; int j = i; j i j < N j N j++ j++ j {
				if (A[minID] > A[j]) {
					minID = j;
				}
			} {
				if (A[minID] > A[j]) {
					minID = j;
				}
			} if (A[minID] > A[j]) {
					minID = j;
				} A[minID] > A[j] A[minID] A minID A[j] A j {
					minID = j;
				} minID = j minID j if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			} minID != i minID i {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			} cnt++ cnt int w = A[i]; w A[i] A i A[i] = A[minID] A[i] A i A[minID] A minID A[minID] = w A[minID] A minID w for (int i = 0; i < A.length; i++) {
			System.out.print(A[i] + (i != A.length - 1 ? " " : "\n"));
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			System.out.print(A[i] + (i != A.length - 1 ? " " : "\n"));
		} {
			System.out.print(A[i] + (i != A.length - 1 ? " " : "\n"));
		} System.out.print(A[i] + (i != A.length - 1 ? " " : "\n")) System.out.print System.out System System.out A[i] + (i != A.length - 1 ? " " : "\n") A[i] A i (i != A.length - 1 ? " " : "\n") i != A.length - 1 i A.length - 1 A.length A A.length 1 " " "\n" System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args public class Main {
	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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	}
} public class Main {
	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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	}
} Main


import java.util.Scanner;

public class Main {
	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();
		}

		// 解法
		// Selection sort, cntは交換回数
		int cnt = 0;
		for (int i = 0; i < N - 1; i++) {
			int minID = i;
			for (int j = i; j < N; j++) {
				if (A[minID] > A[j]) {
					minID = j;
				}
			}
			if (minID != i) {
				cnt++;
				int w = A[i];
				A[i] = A[minID];
				A[minID] = w;
			}
		}

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

		// 入力の開放
		sc.close();
	}
}

