
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    }
    
}

class selection_sort{
    int[] C;
    int Nswap = 0;
    selection_sort(int[] C){
        for(int i = 0; i<C.length; i++){
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        }
        this.C = C;
        
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    }
    
} Main public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] a = new int[N]; a new int[N] N String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        } int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
            a[i] = Integer.parseInt(s[i]);
        } {
            a[i] = Integer.parseInt(s[i]);
        } a[i] = Integer.parseInt(s[i]) a[i] a i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i selection_sort A = new selection_sort(a); A new selection_sort(a) int[] ans = A.C; ans A.C A A.C for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            System.out.print(ans[i] + " ");
        } {
            System.out.print(ans[i] + " ");
        } System.out.print(ans[i] + " ") System.out.print System.out System System.out ans[i] + " " ans[i] ans i " " System.out.println(a[N-1]) System.out.println System.out System System.out a[N-1] a N-1 N 1 System.out.println(A.Nswap) System.out.println System.out System System.out A.Nswap A A.Nswap String[]args args class selection_sort{
    int[] C;
    int Nswap = 0;
    selection_sort(int[] C){
        for(int i = 0; i<C.length; i++){
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        }
        this.C = C;
        
    }
} selection_sort int[] C; C int Nswap = 0; Nswap 0 selection_sort(int[] C){
        for(int i = 0; i<C.length; i++){
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        }
        this.C = C;
        
    } selection_sort {
        for(int i = 0; i<C.length; i++){
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        }
        this.C = C;
        
    } for(int i = 0; i<C.length; i++){
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        } int i = 0; int i = 0; i 0 i<C.length i C.length C C.length i++ i++ i {
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        } {
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        } int mini = i; mini i for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            } int j = i; int j = i; j i j<C.length j C.length C C.length j++ j++ j {
                if(C[j]<C[mini]){
                   mini = j; 
                }
            } {
                if(C[j]<C[mini]){
                   mini = j; 
                }
            } if(C[j]<C[mini]){
                   mini = j; 
                } C[j]<C[mini] C[j] C j C[mini] C mini {
                   mini = j; 
                } mini = j mini j if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            } mini!=i mini i {
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            } int tmp = C[i]; tmp C[i] C i C[i] = C[mini] C[i] C i C[mini] C mini C[mini] = tmp C[mini] C mini tmp Nswap++ Nswap this.C = C this.C this this.C C int[] C C public class Main {
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    }
    
} public class Main {
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    }
    
} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] a = new int[N];
        String[] s = br.readLine().split(" ");
        for(int i = 0;i<N;i++){
            a[i] = Integer.parseInt(s[i]);
        }
        
        
        selection_sort A = new selection_sort(a);
        int[] ans = A.C;
        for(int i=0;i<N-1;i++){
            System.out.print(ans[i] + " ");
        }
        System.out.println(a[N-1]);
        System.out.println(A.Nswap);
        
        
        
        
    }
    
}

class selection_sort{
    int[] C;
    int Nswap = 0;
    selection_sort(int[] C){
        for(int i = 0; i<C.length; i++){
            int mini = i;
            for(int j = i; j<C.length; j++){
                if(C[j]<C[mini]){
                   mini = j; 
                }
            }
            if(mini!=i){
                int tmp = C[i];
                C[i] = C[mini];
                C[mini] = tmp;
                Nswap++;
            }
        }
        this.C = C;
        
    }
}