import java.util.Scanner;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        System.out.println(count);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        System.out.println(count);
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        System.out.println(count);
    } main {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        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 int[] A; A A = new int[N] A new int[N] N int i; i for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        } i = 0; i = 0 i 0 i < N i N i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        } int j = 0; int j = 0; j 0 j < A.length - 1 j A.length - 1 A.length A A.length 1 j++ j++ j {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        } {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        } int keyindex = j; keyindex j for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            } int k = j + 1; int k = j + 1; k j + 1 j 1 k < A.length k A.length A A.length k++ k++ k {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            } {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            } if (A[keyindex] > A[k]) {

                    keyindex = k;

                } A[keyindex] > A[k] A[keyindex] A keyindex A[k] A k {

                    keyindex = k;

                } keyindex = k keyindex k if (j == keyindex) {
                continue;
            } j == keyindex j keyindex {
                continue;
            } continue; int temp = A[j]; temp A[j] A j A[j] = A[keyindex] A[j] A j A[keyindex] A keyindex A[keyindex] = temp A[keyindex] A keyindex temp count++ count for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        } int g = 0; int g = 0; g 0 g < N g N g++ g++ g {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        } {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        } System.out.print(A[g]) System.out.print System.out System System.out A[g] A g if (g < N - 1) {
                System.out.print(" ");
            } g < N - 1 g N - 1 N 1 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " if (g == N - 1) {
                System.out.println("");
            } g == N - 1 g N - 1 N 1 {
                System.out.println("");
            } System.out.println("") System.out.println System.out System System.out "" 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) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        System.out.println(count);
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        System.out.println(count);
    }
} Main
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A;
        A = new int[N];
        int i;
        for (i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int count = 0;

        for (int j = 0; j < A.length - 1; j++) {

            int keyindex = j;

            for (int k = j + 1; k < A.length; k++) {

                if (A[keyindex] > A[k]) {

                    keyindex = k;

                }
            }



            if (j == keyindex) {
                continue;
            }
            int temp = A[j];
            A[j] = A[keyindex];
            A[keyindex] = temp;
            count++;
        }


        for (int g = 0; g < N; g++) {
            System.out.print(A[g]);
            if (g < N - 1) {
                System.out.print(" ");
            }
            if (g == N - 1) {
                System.out.println("");
            }

        }

        System.out.println(count);
    }
}

