import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    } main {
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int n n minN minN q=0; q 0 n=scan.nextInt() n scan.nextInt() scan.nextInt scan int[] sort=new int[n]; sort new int[n] n for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            sort[i]=scan.nextInt();
        } {
            sort[i]=scan.nextInt();
        } sort[i]=scan.nextInt() sort[i] sort i scan.nextInt() scan.nextInt scan for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        } {
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        } minN=i minN i for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            } {
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            } if(sort[minN]>sort[j]){
                    minN=j;
                } sort[minN]>sort[j] sort[minN] sort minN sort[j] sort j {
                    minN=j;
                } minN=j minN j if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            } minN!=i minN i {
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            } sort[i]^=sort[minN] sort[i] sort i sort[minN] sort minN sort[minN]^=sort[i] sort[minN] sort minN sort[i] sort i sort[i]^=sort[minN] sort[i] sort i sort[minN] sort minN q++ q for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        } {
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        } System.out.print(sort[i]) System.out.print System.out System System.out sort[i] sort i if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println(); i!=n-1 i n-1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(q) System.out.println System.out System System.out q String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n,minN,q=0;
        n=scan.nextInt();
        int[] sort=new int[n];
        for(int i=0; i<n; i++){
            sort[i]=scan.nextInt();
        }
        //System.out.println(Arrays.toString(sort));
        
        for(int i=0; i<n; i++){
            minN=i;
            for(int j=i+1; j<n; j++){
                if(sort[minN]>sort[j]){
                    minN=j;
                }
            }
            if(minN!=i){
                sort[i]^=sort[minN];
                sort[minN]^=sort[i];
                sort[i]^=sort[minN];
                q++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(sort[i]);
            if(i!=n-1)
                System.out.print(" ");
            else
                System.out.println();
        }
        System.out.println(q);
    }
}
