import java.io.*;
import java.util.*;



class Main{
    //読み込みのテンプレ(stringオブジェクトまで)
    
    static int N;
    static int[] sequence;
    static int count;
    
    public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        //配列にsequenceを打ち込む
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doSelectsort(sequence);
        showResult(sequence);
        System.out.println(count);
    }
    
    
    public static int[] doSelectsort(int[] sequence){
        for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        }
        return sequence;
    }
    
    
    //出力
    public static void showResult(int[] sequence){
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    }
    
} import java.io.*; io.* java import java.util.*; util.* java class Main{
    //読み込みのテンプレ(stringオブジェクトまで)
    
    static int N;
    static int[] sequence;
    static int count;
    
    public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        //配列にsequenceを打ち込む
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doSelectsort(sequence);
        showResult(sequence);
        System.out.println(count);
    }
    
    
    public static int[] doSelectsort(int[] sequence){
        for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        }
        return sequence;
    }
    
    
    //出力
    public static void showResult(int[] sequence){
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    }
    
} Main static int N; N static int[] sequence; sequence static int count; count public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        //配列にsequenceを打ち込む
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doSelectsort(sequence);
        showResult(sequence);
        System.out.println(count);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        //配列にsequenceを打ち込む
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doSelectsort(sequence);
        showResult(sequence);
        System.out.println(count);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] sequence = new int[N]; sequence new int[N] N for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            sequence[i]=scanner.nextInt();
        } {
            sequence[i]=scanner.nextInt();
        } sequence[i]=scanner.nextInt() sequence[i] sequence i scanner.nextInt() scanner.nextInt scanner sequence =  doSelectsort(sequence) sequence doSelectsort(sequence) doSelectsort sequence showResult(sequence) showResult sequence System.out.println(count) System.out.println System.out System System.out count String[] args args public static int[] doSelectsort(int[] sequence){
        for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        }
        return sequence;
    } doSelectsort {
        for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        }
        return sequence;
    } for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        } int i=0; int i=0; i 0 i<sequence.length i sequence.length sequence sequence.length i++ i++ i {
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        } {
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        } int minimum = i; minimum i for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            } int j= i+1; int j= i+1; j i+1 i 1 j<sequence.length j sequence.length sequence sequence.length j++ j++ j {
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            } {
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            } if(sequence[minimum] > sequence[j]){
                    minimum = j;
                } sequence[minimum] > sequence[j] sequence[minimum] sequence minimum sequence[j] sequence j {
                    minimum = j;
                } minimum = j minimum j int x = sequence[i]; x sequence[i] sequence i int y = sequence[minimum]; y sequence[minimum] sequence minimum sequence[i]=y sequence[i] sequence i y sequence[minimum]=x sequence[minimum] sequence minimum x if(i!=minimum)count++; i!=minimum i minimum count++ count return sequence; sequence int[] sequence sequence //出力
    public static void showResult(int[] sequence){
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    } showResult {
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    } for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        } int i =0; int i =0; i 0 i<sequence.length-1 i sequence.length-1 sequence.length sequence sequence.length 1 i++ i++ i {
            int number = sequence[i];
            System.out.print(number + " ");
        } {
            int number = sequence[i];
            System.out.print(number + " ");
        } int number = sequence[i]; number sequence[i] sequence i System.out.print(number + " ") System.out.print System.out System System.out number + " " number " " System.out.println(sequence[sequence.length-1]) System.out.println System.out System System.out sequence[sequence.length-1] sequence sequence.length-1 sequence.length sequence sequence.length 1 int[] sequence sequence
import java.io.*;
import java.util.*;



class Main{
    //読み込みのテンプレ(stringオブジェクトまで)
    
    static int N;
    static int[] sequence;
    static int count;
    
    public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        //配列にsequenceを打ち込む
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doSelectsort(sequence);
        showResult(sequence);
        System.out.println(count);
    }
    
    
    public static int[] doSelectsort(int[] sequence){
        for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        }
        return sequence;
    }
    
    
    //出力
    public static void showResult(int[] sequence){
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    }
    
}