
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];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		System.out.println(count);
	}
	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	}

}
 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];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		System.out.println(count);
	}
	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	}

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		System.out.println(count);
	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		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 int count = 0; count 0 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 for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		} {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		} int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int minj = 0; minj 0 for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			} int j = i+1; int j = i+1; j i+1 i 1 j < n j n j++ j++ j {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			} {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			} if (min > a[j]) {
					min = a[j];
					minj = j;
				} min > a[j] min a[j] a j {
					min = a[j];
					minj = j;
				} min = a[j] min a[j] a j minj = j minj j if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			} a[i] > min a[i] a i min {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			} int tmp = a[i]; tmp a[i] a i a[i] = min a[i] a i min a[minj] = tmp a[minj] a minj tmp count++ count print(a) print a System.out.println(count) System.out.println System.out System System.out count String[] args args static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	} print {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	} for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		} 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]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		} {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if (i != a.length-1) {
				System.out.print(" ");
			} i != a.length-1 i a.length-1 a.length a a.length 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" int[] a a public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		System.out.println(count);
	}
	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		System.out.println(count);
	}
	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	}

} 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];
		int count = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int minj = 0;
			for (int j = i+1; j < n; j++) {
				if (min > a[j]) {
					min = a[j];
					minj = j;
				}
			}
			if (a[i] > min) {
				int tmp = a[i];
				a[i] = min;
				a[minj] = tmp;
				count++;
			}
		}
		print(a);
		System.out.println(count);
	}
	static void print(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length-1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	}

}

