import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    }
} 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[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = scanner.nextInt();
        } {
            a[i] = scanner.nextInt();
        } a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner int swap = 0; swap 0 for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        } 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[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        } {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        } int minj = i; minj i for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            } int j = i+1; int j = i+1; j i+1 i 1 j < n j n j++ j++ j {
                if (a[j] < a[minj])
                    minj = j;
            } {
                if (a[j] < a[minj])
                    minj = j;
            } if (a[j] < a[minj])
                    minj = j; a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            } minj != i minj i {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            } 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 swap++ swap for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        } {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        } if (i > 0)
                System.out.print(' '); i > 0 i 0 System.out.print(' ') System.out.print System.out System System.out ' ' System.out.print(a[i]) System.out.print System.out System System.out a[i] a i System.out.println("") System.out.println System.out System System.out "" System.out.println(swap) System.out.println System.out System System.out swap String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int swap = 0;
        for (int i = 0; i < n-1; i++) {
            int minj = i;
            for (int j = i+1; j < n; j++) {
                if (a[j] < a[minj])
                    minj = j;
            }
            if (minj != i) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                swap++;
            }
        }
        for (int i = 0; i < n; i++) {
            // System.out.print(a[i]+" "); // AOJ doesn't allow extra blanks.
            if (i > 0)
                System.out.print(' ');
            System.out.print(a[i]);
        }
        System.out.println("");
        System.out.println(swap);
    }
}
