import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    }
}

class SelectionSort{
    int[] selSort;
    public SelectionSort(int[] selSort){
        this.selSort = selSort;
    }
    
    int count = 0;
    public void changeOfSNum(){
        int maxNum = 0;
        int flag = 0;
        for(int i = 0, j; i < selSort.length; i++){
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        }
    }
    
    public void outPutOfSNum(){
        for(int i = 0; i < selSort.length; i++){
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        }
        System.out.print("\n");
    }
    
    public void outPutCount(){
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    } main {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] selSort = new int[sc.nextInt()]; selSort new int[sc.nextInt()] sc.nextInt() sc.nextInt sc for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < selSort.length i selSort.length selSort selSort.length i++ i++ i {
            selSort[i] = sc.nextInt();
        } {
            selSort[i] = sc.nextInt();
        } selSort[i] = sc.nextInt() selSort[i] selSort i sc.nextInt() sc.nextInt sc SelectionSort ss = new SelectionSort(selSort); ss new SelectionSort(selSort) ss.changeOfSNum() ss.changeOfSNum ss ss.outPutOfSNum() ss.outPutOfSNum ss ss.outPutCount() ss.outPutCount ss String[] args args class SelectionSort{
    int[] selSort;
    public SelectionSort(int[] selSort){
        this.selSort = selSort;
    }
    
    int count = 0;
    public void changeOfSNum(){
        int maxNum = 0;
        int flag = 0;
        for(int i = 0, j; i < selSort.length; i++){
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        }
    }
    
    public void outPutOfSNum(){
        for(int i = 0; i < selSort.length; i++){
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        }
        System.out.print("\n");
    }
    
    public void outPutCount(){
        System.out.println(count);
    }
} SelectionSort int[] selSort; selSort int count = 0; count 0 public SelectionSort(int[] selSort){
        this.selSort = selSort;
    } SelectionSort {
        this.selSort = selSort;
    } this.selSort = selSort this.selSort this this.selSort selSort int[] selSort selSort public void changeOfSNum(){
        int maxNum = 0;
        int flag = 0;
        for(int i = 0, j; i < selSort.length; i++){
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        }
    } changeOfSNum {
        int maxNum = 0;
        int flag = 0;
        for(int i = 0, j; i < selSort.length; i++){
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        }
    } int maxNum = 0; maxNum 0 int flag = 0; flag 0 for(int i = 0, j; i < selSort.length; i++){
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        } int i = 0, j; int i = 0 i 0 j; j i < selSort.length i selSort.length selSort selSort.length i++ i++ i {
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        } {
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        } maxNum = selSort[i] maxNum selSort[i] selSort i j = i + 1 j i + 1 i 1 while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            } j < selSort.length j selSort.length selSort selSort.length {
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            } if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                } selSort[j] < selSort[i] selSort[j] selSort j selSort[i] selSort i {
                    selSort[i] = selSort[j];
                    flag = j;
                } selSort[i] = selSort[j] selSort[i] selSort i selSort[j] selSort j flag = j flag j j++ j if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            } maxNum != selSort[i] maxNum selSort[i] selSort i {
                selSort[flag] = maxNum;
                count++;
            } selSort[flag] = maxNum selSort[flag] selSort flag maxNum count++ count public void outPutOfSNum(){
        for(int i = 0; i < selSort.length; i++){
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        }
        System.out.print("\n");
    } outPutOfSNum {
        for(int i = 0; i < selSort.length; i++){
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        }
        System.out.print("\n");
    } for(int i = 0; i < selSort.length; i++){
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        } int i = 0; int i = 0; i 0 i < selSort.length i selSort.length selSort selSort.length i++ i++ i {
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        } {
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        } if(i == 0){
                System.out.print(selSort[i]);
                continue;
            } i == 0 i 0 {
                System.out.print(selSort[i]);
                continue;
            } System.out.print(selSort[i]) System.out.print System.out System System.out selSort[i] selSort i continue; System.out.print(" " + selSort[i]) System.out.print System.out System System.out " " + selSort[i] " " selSort[i] selSort i System.out.print("\n") System.out.print System.out System System.out "\n" public void outPutCount(){
        System.out.println(count);
    } outPutCount {
        System.out.println(count);
    } System.out.println(count) System.out.println System.out System System.out count public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] selSort = new int[sc.nextInt()];
        
        for(int i = 0; i < selSort.length; i++){
            selSort[i] = sc.nextInt();
        }
        
        SelectionSort ss = new SelectionSort(selSort);
        ss.changeOfSNum();
        ss.outPutOfSNum();
        ss.outPutCount();
    }
}

class SelectionSort{
    int[] selSort;
    public SelectionSort(int[] selSort){
        this.selSort = selSort;
    }
    
    int count = 0;
    public void changeOfSNum(){
        int maxNum = 0;
        int flag = 0;
        for(int i = 0, j; i < selSort.length; i++){
            maxNum = selSort[i];
            j = i + 1;
            while(j < selSort.length){
                if(selSort[j] < selSort[i]){
                    selSort[i] = selSort[j];
                    flag = j;
                }
                j++;
            }
            if(maxNum != selSort[i]){
                selSort[flag] = maxNum;
                count++;
            }
        }
    }
    
    public void outPutOfSNum(){
        for(int i = 0; i < selSort.length; i++){
            if(i == 0){
                System.out.print(selSort[i]);
                continue;
            }
            System.out.print(" " + selSort[i]);
        }
        System.out.print("\n");
    }
    
    public void outPutCount(){
        System.out.println(count);
    }
}
