import java.util.Scanner;

public class Main {

	public static void selection_sort(int[] a) {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	}

	public static void display(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		}
	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void selection_sort(int[] a) {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	}

	public static void display(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		}
	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	}
} Main public static void selection_sort(int[] a) {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	} selection_sort {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	} int num_swaps = 0; num_swaps 0 for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		} {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		} int mini = i; mini i for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = 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[mini])
					mini = j;
			} {
				if (a[j] < a[mini])
					mini = j;
			} if (a[j] < a[mini])
					mini = j; a[j] < a[mini] a[j] a j a[mini] a mini mini = j mini j int tmp = a[i]; tmp a[i] a i a[i] = a[mini] a[i] a i a[mini] a mini a[mini] = tmp a[mini] a mini tmp if (i != mini)
				num_swaps++; i != mini i mini num_swaps++ num_swaps display(a) display a System.out.println(num_swaps) System.out.println System.out System System.out num_swaps int[] a a public static void display(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		}
	} display {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				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(" ");
			else
				System.out.print("\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]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		} {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		} 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(" ");
			else
				System.out.print("\n"); i != a.length - 1 i a.length - 1 a.length a a.length 1 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 static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	} main {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = s.nextInt();
		} {
			a[i] = s.nextInt();
		} a[i] = s.nextInt() a[i] a i s.nextInt() s.nextInt s selection_sort(a) selection_sort a String[] args args public class Main {

	public static void selection_sort(int[] a) {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	}

	public static void display(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		}
	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	}
} public class Main {

	public static void selection_sort(int[] a) {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	}

	public static void display(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		}
	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void selection_sort(int[] a) {
		int num_swaps = 0;
		for (int i = 0; i < a.length; i++) {
			int mini = i;
			for (int j = i; j < a.length; j++) {
				if (a[j] < a[mini])
					mini = j;
			}
			// swap
			int tmp = a[i];
			a[i] = a[mini];
			a[mini] = tmp;
			if (i != mini)
				num_swaps++;
		}
		display(a);
		System.out.println(num_swaps);
	}

	public static void display(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1)
				System.out.print(" ");
			else
				System.out.print("\n");
		}
	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		selection_sort(a);
	}
}
