import java.util.*;

public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    }
} Main public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    } main {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    } int total; total Scanner inp = new Scanner(System.in); inp new Scanner(System.in) total = inp.nextInt() total inp.nextInt() inp.nextInt inp int[] a = new int[total]; a new int[total] total for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        } int k = 0; int k = 0; k 0 k < total k total k++ k++ k {
            a[k] = inp.nextInt();
        } {
            a[k] = inp.nextInt();
        } a[k] = inp.nextInt() a[k] a k inp.nextInt() inp.nextInt inp int swapcount = 0; swapcount 0 for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        } int i = 0; int i = 0; i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        } {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        } int mini = i; mini i for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            } int j = i; int j = i; j i j < a.length j a.length a a.length j++ j++ j {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            } {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            } if (a[j] < a[mini]) {
                    mini = j;
                } a[j] < a[mini] a[j] a j a[mini] a mini {
                    mini = j;
                } mini = j mini j if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            } i != mini i mini {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            } int temp = a[i]; temp a[i] a i a[i] = a[mini] a[i] a i a[mini] a mini a[mini] = temp a[mini] a mini temp swapcount++ swapcount for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        } int l = 0; int l = 0; l 0 l < total l total l++ l++ l {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        } {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        } if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            } l == 0 l 0 {
                System.out.printf("%d", a[l]);
            } System.out.printf("%d", a[l]) System.out.printf System.out System System.out "%d" a[l] a l {
                System.out.printf(" %d", a[l]);
            } System.out.printf(" %d", a[l]) System.out.printf System.out System System.out " %d" a[l] a l System.out.printf("\n" + swapcount+"\n") System.out.printf System.out System System.out "\n" + swapcount+"\n" "\n" + swapcount+"\n" "\n" swapcount "\n" String[] args args public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    }
} public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        int swapcount = 0;

        for (int i = 0; i < a.length-1; i++) {
            int mini = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }

            if (i != mini) {
                int temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;

                swapcount++;
            }
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n" + swapcount+"\n");
    }
}

