import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    } main {
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i i j; j int count = 0; count 0 int min; min int minnum; minnum int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int A[] = new int[n]; A new int[n] n 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 for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        } i=0; i=0 i 0 i<n-1 i n-1 n 1 i++ i++ i {
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        } {
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        } min = A[i] min A[i] A i minnum = i minnum i for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            } j=i+1; j=i+1 j i+1 i 1 j<n j n j++ j++ j {
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            } {
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            } if(A[j]<min){
                    min = A[j];
                    minnum = j;
                } A[j]<min A[j] A j min {
                    min = A[j];
                    minnum = j;
                } min = A[j] min A[j] A j minnum = j minnum j if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            } minnum != i minnum i {
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            } int r = A[minnum]; r A[minnum] A minnum A[minnum] = A[i] A[minnum] A minnum A[i] A i A[i] = r A[i] A i r count++ count for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        } i=0; i=0 i 0 i<n i n i++ i++ i {
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        } {
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        } System.out.printf("%d",A[i]) System.out.printf System.out System System.out "%d" A[i] A i if(i != n-1) System.out.printf(" "); i != n-1 i n-1 n 1 System.out.printf(" ") System.out.printf System.out System System.out " " System.out.printf("\n") System.out.printf System.out System System.out "\n" System.out.printf("%d\n",count) System.out.printf System.out System System.out "%d\n" count String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i,j;
        int count = 0;
        int min;
        int minnum;
        int n = sc.nextInt();
        int A[] = new int[n];
        for(i=0;i<n;i++){
            A[i] = sc.nextInt();
        }
        for(i=0;i<n-1;i++){
            min = A[i];
            minnum = i;
            for(j=i+1;j<n;j++){
                if(A[j]<min){
                    min = A[j];
                    minnum = j;
                }
            }
            if(minnum != i){
                int r = A[minnum];
                A[minnum] = A[i];
                A[i] = r;
                count++;
            }
        }
        for(i=0;i<n;i++){
            System.out.printf("%d",A[i]);
            if(i != n-1) System.out.printf(" ");
        }
        System.out.printf("\n");
        System.out.printf("%d\n",count);
    }
}

