import java.util.Scanner;

public class Main {
	void run() {
		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();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		}
		for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
		System.out.println(count);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	void run() {
		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();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		}
		for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
		System.out.println(count);
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		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();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		}
		for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
		System.out.println(count);
	} run {
		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();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		}
		for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
		System.out.println(count);
	} 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] a i scan.nextInt() scan.nextInt scan int count = 0; count 0 for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		} {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		} int min_j = i; min_j i for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if (a[j] < a[min_j])
					min_j = j;
			} {
				if (a[j] < a[min_j])
					min_j = j;
			} if (a[j] < a[min_j])
					min_j = j; a[j] < a[min_j] a[j] a j a[min_j] a min_j min_j = j min_j j if (i != min_j)
				count++; i != min_j i min_j count++ count int tmp = a[i]; tmp a[i] a i a[i] = a[min_j] a[i] a i a[min_j] a min_j a[min_j] = tmp a[min_j] a min_j tmp for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n")); int i = 0; int i = 0; i 0 i < n i n i++ i++ i System.out.print(a[i] + (i != n - 1 ? " ":"\n")); System.out.print(a[i] + (i != n - 1 ? " ":"\n")) System.out.print System.out System System.out a[i] + (i != n - 1 ? " ":"\n") a[i] a i (i != n - 1 ? " ":"\n") i != n - 1 i n - 1 n 1 " " "\n" System.out.println(count) System.out.println System.out System System.out count public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	void run() {
		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();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		}
		for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
		System.out.println(count);
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	void run() {
		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();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min_j = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[min_j])
					min_j = j;
			}
			if (i != min_j)
				count++;
			int tmp = a[i];
			a[i] = a[min_j];
			a[min_j] = tmp;
		}
		for (int i = 0; i < n; i++)
			System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
		System.out.println(count);
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;

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

