import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		solve();
	} main {
		solve();
	} solve() solve String[] args args private static void solve() {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	} solve {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	} 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 int count = 0; count 0 for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		} {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		} int minIndex = i; minIndex i for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			} {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			} if (a[j] < a[minIndex]) {
					minIndex = j;
				} a[j] < a[minIndex] a[j] a j a[minIndex] a minIndex {
					minIndex = j;
				} minIndex = j minIndex j if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			} minIndex != i minIndex i {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			} int tmp = a[i]; tmp a[i] a i a[i] = a[minIndex] a[i] a i a[minIndex] a minIndex a[minIndex] = tmp a[minIndex] a minIndex tmp count++ count for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		} {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if (i != n - 1) {
				System.out.print(" ");
			} i != n - 1 i n - 1 n 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.print("\n") System.out.print System.out System System.out "\n" System.out.println(count) System.out.println System.out System System.out count public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		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();

		int count = 0;
		for (int i = 0; i < n; i++) {
			int minIndex = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minIndex]) {
					minIndex = j;
				}
			}
			if (minIndex != i) {
				int tmp = a[i];
				a[i] = a[minIndex];
				a[minIndex] = tmp;
				count++;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if (i != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
		System.out.println(count);
	}
}