import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

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

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

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

} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

		for (int i=0; i < n-1; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println(a[n-1]);
		System.out.println(count);
	} main {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

		for (int i=0; i < n-1; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println(a[n-1]);
		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 sc.nextLine() sc.nextLine sc String[] datastr = sc.nextLine().split(" "); datastr sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] a = new int[n]; a new int[n] n for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		} int i=0; int i=0; i 0 i < n i n i++ i++ i {
			a[i] = Integer.parseInt(datastr[i]);
		} {
			a[i] = Integer.parseInt(datastr[i]);
		} a[i] = Integer.parseInt(datastr[i]) a[i] a i Integer.parseInt(datastr[i]) Integer.parseInt Integer datastr[i] datastr i int count = 0; count 0 for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		} int i=0; int i=0; i 0 i < n i n i++ i++ i {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		} {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		} int minj = i; minj i for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			} int j=i; int j=i; j i j < n j n j++ j++ j {
				if (a[minj] > a[j]) {
					minj = j;
				}
			} {
				if (a[minj] > a[j]) {
					minj = j;
				}
			} if (a[minj] > a[j]) {
					minj = j;
				} a[minj] > a[j] a[minj] a minj a[j] a j {
					minj = j;
				} minj = j minj j if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			} minj != i minj i {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			} int temp = a[i]; temp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = temp a[minj] a minj temp count++ count for (int i=0; i < n-1; i++) {
			System.out.print(a[i] + " ");
		} int i=0; int i=0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			System.out.print(a[i] + " ");
		} {
			System.out.print(a[i] + " ");
		} System.out.print(a[i] + " ") System.out.print System.out System System.out a[i] + " " a[i] a i " " System.out.println(a[n-1]) System.out.println System.out System System.out a[n-1] a n-1 n 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

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

} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

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

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		String[] datastr = sc.nextLine().split(" ");
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = Integer.parseInt(datastr[i]);
		}

		int count = 0;
		for (int i=0; i < n; i++) {

			int minj = i;
			for ( int j=i; j < n; j++) {
				if (a[minj] > a[j]) {
					minj = j;
				}
			}

			// swap( a[i], a[minj] )
			// temp <- a[i] <- a[minj] <- temp
			if (minj != i) {
				int temp = a[i];
				a[i] = a[minj];
				a[minj] = temp;
				count++;
			}

		}

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

}