import java.util.Scanner;

// ALDS1_2_B
public class Main {
        void selectionSort(int[] array, int n) {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        }
        
        void run() {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        }

        public static void main(String[] args) {
                new Main().run();
        }
} import java.util.Scanner; Scanner java.util public class Main {
        void selectionSort(int[] array, int n) {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        }
        
        void run() {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        }

        public static void main(String[] args) {
                new Main().run();
        }
} Main void selectionSort(int[] array, int n) {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        } selectionSort {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        } int tmp tmp minj minj count = 0; count 0 for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                } {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                } minj = i minj i for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        } int j = i; int j = i; j i j < n j n j++ j++ j {
                                if (array[j] < array[minj]) minj = j;
                        } {
                                if (array[j] < array[minj]) minj = j;
                        } if (array[j] < array[minj]) minj = j; array[j] < array[minj] array[j] array j array[minj] array minj minj = j minj j if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        } minj != i minj i {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        } tmp = array[i] tmp array[i] array i array[i] = array[minj] array[i] array i array[minj] array minj array[minj] = tmp array[minj] array minj tmp count++ count for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                } {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                } System.out.print(array[i]) System.out.print System.out System System.out array[i] array i if (i < n - 1) System.out.print(" "); i < n - 1 i n - 1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count int[] array array int n n void run() {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        } run {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                    array[i] = sc.nextInt();
            } {
                    array[i] = sc.nextInt();
            } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc selectionSort(array, n) selectionSort array n 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 selectionSort(int[] array, int n) {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        }
        
        void run() {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        }

        public static void main(String[] args) {
                new Main().run();
        }
} public class Main {
        void selectionSort(int[] array, int n) {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        }
        
        void run() {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        }

        public static void main(String[] args) {
                new Main().run();
        }
} Main
import java.util.Scanner;

// ALDS1_2_B
public class Main {
        void selectionSort(int[] array, int n) {
                int tmp, minj, count = 0;
                for (int i = 0; i < n; i++) {
                        minj = i;
                        for (int j = i; j < n; j++) {
                                if (array[j] < array[minj]) minj = j;
                        }
                        if (minj != i) {
                                tmp = array[i]; array[i] = array[minj]; array[minj] = tmp;
                                count++;
                        }
                }
                for (int i = 0; i < n; i++) {
                        System.out.print(array[i]);
                        if (i < n - 1) System.out.print(" ");
                }
                System.out.println();
                System.out.println(count);
        }
        
        void run() {
        		Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                    array[i] = sc.nextInt();
            }
            selectionSort(array, n);
        }

        public static void main(String[] args) {
                new Main().run();
        }
}
