function main(input){
    const int = parseInt;
    const lines = input.split("\n");
    const length = int(lines[0]);
    let nums = lines[1].split(" ").map(item=>int(item));
    let sortingIndex =0;
    let swapCount=0;
    let put = "";

    for(let i=sortingIndex;i<length-1;i++){
        let minIndex = sortingIndex;
        let swapped = false;

        for(let j=sortingIndex;j<length;j++){
            if(nums[j]<nums[minIndex]){
                minIndex = j;
                swapped = true;
            }
            
        }
        if(swapped){
            let temp = nums[i];
            nums[i]=nums[minIndex];
            nums[minIndex]=temp;
            swapCount++;
        }
        sortingIndex++;
    }
    
    
    for(let i=0;i<length;i++){
        put += nums[i] + " ";
    }
    
    console.log(put.trim());
    console.log(swapCount);
    
    
}





main(require("fs").readFileSync("/dev/stdin",'utf-8'));
