import java.util.Scanner;
import java.util.TreeSet;
import java.util.Arrays;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
}
}

 import java.util.Scanner; Scanner java.util import java.util.TreeSet; TreeSet java.util import java.util.Arrays; Arrays java.util public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
}
} Main public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
} main {
        Scanner sc=new Scanner(System.in);
        int n;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n; n n= sc.nextInt() n sc.nextInt() sc.nextInt sc int [] a=new int[n]; a new int[n] n for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       } int i=0; int 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 i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       } int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       } {
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       } int m=a[i]; m a[i] a i int comp=1000000; comp 1000000 int minj=0; minj 0 for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           } int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           } {
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           } if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                } comp>a[j] comp a[j] a j {
                    minj=j;
                    comp=a[j];
                } minj=j minj j comp=a[j] comp a[j] a j if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        } m>comp m comp {
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        } 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 count++ count for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       } int i=0; int i=0; i 0 i<n i n i++ i++ i {
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       } {
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       } if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]); i!=(n-1) i (n-1) n 1 System.out.print(a[i]+" ") System.out.print System.out System System.out a[i]+" " a[i] a i " " System.out.println(a[i]) System.out.println System.out System System.out a[i] a i 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;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
}
} public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
}
} Main
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Arrays;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
       n= sc.nextInt();
       int [] a=new int[n];
       for(int i=0;i<n;i++){
           a[i]=sc.nextInt();
       }
       int count=0;
       for(int i=0;i<n-1;i++){
           int m=a[i];
           int comp=1000000;
           int minj=0;
           for(int j=i+1;j<n;j++){
                if(comp>a[j]){
                    minj=j;
                    comp=a[j];
                }
           }
           if(m>comp){
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
            count++;
        }
       }

       for(int i=0;i<n;i++){
        if(i!=(n-1))System.out.print(a[i]+" ");
        else  System.out.println(a[i]);
       }
       System.out.println(count);
}
}


