import java.util.Arrays;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    }

    private static void selectionSort(int n, int[] a) {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    }

    private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    }

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

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    }

    private static void selectionSort(int n, int[] a) {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    }

    private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    }

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

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    } main {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] nums = new int[n]; nums new int[n] n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i nums[i] = scanner.nextInt(); nums[i] = scanner.nextInt() nums[i] nums i scanner.nextInt() scanner.nextInt scanner selectionSort(n, nums) selectionSort n nums String[] args args private static void selectionSort(int n, int[] a) {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    } selectionSort {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    } int sw = 0; sw 0 for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	} int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	} {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	} int minj = i; minj i for (int j = i + 1; j < n; j++) {
    			if (a[minj] > 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 (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 if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		} minj != i minj i {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		} int tmp = a[i]; tmp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = tmp a[minj] a minj tmp sw++ sw trace(a) trace a System.out.println(sw) System.out.println System.out System System.out sw int n n int[] a a private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    } trace {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    } System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", "")) System.out.println System.out System System.out Arrays.toString(nums).replaceAll("[\\[\\],]", "") Arrays.toString(nums).replaceAll Arrays.toString(nums) Arrays.toString Arrays nums "[\\[\\],]" "" int[] nums nums public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    }

    private static void selectionSort(int n, int[] a) {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    }

    private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    }

} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    }

    private static void selectionSort(int n, int[] a) {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    }

    private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    }

} Main
import java.util.Arrays;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        selectionSort(n, nums);
    }

    private static void selectionSort(int n, int[] a) {
    	int sw = 0;
    	for (int i = 0; i < n - 1; i++) {
    		int minj = i;
    		for (int j = i + 1; j < n; j++) {
    			if (a[minj] > a[j]) minj = j;
    		}
    		if (minj != i) {
    			int tmp = a[i];
    			a[i] = a[minj];
    			a[minj] = tmp;
    			sw++;
     		}
    	}
    	trace(a);
    	System.out.println(sw);
    }

    private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    }

}
