
import java.util.Scanner;

public class Main {
    public static void select_Sort(int n, int A[]) {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void select_Sort(int n, int A[]) {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    }
} Main public static void select_Sort(int n, int A[]) {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    } select_Sort {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    } int min = 0; min 0 int mini = 0; mini 0 int x=0; x 0 int sortNum = 0; sortNum 0 for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        } {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        } for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            } {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            } if(j==i+1){
                    min=A[j];
                    mini=j;
                } j==i+1 j i+1 i 1 {
                    min=A[j];
                    mini=j;
                } min=A[j] min A[j] A j mini=j mini j if(min > A[j]){
                    min=A[j];
                    mini=j;
                } min > A[j] min A[j] A j {
                    min=A[j];
                    mini=j;
                } min=A[j] min A[j] A j mini=j mini j if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            } A[i] > A[mini] A[i] A i A[mini] A mini {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            } x = A[mini] x A[mini] A mini A[mini] = A[i] A[mini] A mini A[i] A i A[i] = x A[i] A i x sortNum++ sortNum System.out.printf("%d", A[0]) System.out.printf System.out System System.out "%d" A[0] A 0 for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        } int k = 1; int k = 1; k 1 k < n k n k++ k++ k {
            System.out.printf(" %d", A[k]);
        } {
            System.out.printf(" %d", A[k]);
        } System.out.printf(" %d", A[k]) System.out.printf System.out System System.out " %d" A[k] A k System.out.printf("\n") System.out.printf System.out System System.out "\n" System.out.println(sortNum) System.out.println System.out System System.out sortNum int n n int A[] A public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] A = new int[n]; A new int[n] n for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            A[i] = scan.nextInt();
        } {
            A[i] = scan.nextInt();
        } A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan scan.close() scan.close scan select_Sort(n, A) select_Sort n A return; String[] args args public class Main {
    public static void select_Sort(int n, int A[]) {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    }
} public class Main {
    public static void select_Sort(int n, int A[]) {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    }
} Main

import java.util.Scanner;

public class Main {
    public static void select_Sort(int n, int A[]) {
        int min = 0;
        int mini = 0;
        int x=0;
        int sortNum = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(j==i+1){
                    min=A[j];
                    mini=j;
                }
                if(min > A[j]){
                    min=A[j];
                    mini=j;
                }
            }
            if (A[i] > A[mini]) {
                x = A[mini];
                A[mini] = A[i];
                A[i] = x;
                sortNum++;
            }
        }
        System.out.printf("%d", A[0]);
        for (int k = 1; k < n; k++) {
            System.out.printf(" %d", A[k]);
        }
        System.out.printf("\n");
        System.out.println(sortNum);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();
        select_Sort(n, A);
        return;
    }
}
