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);
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz