function main(_stdin) {
    const stdin = _stdin.split('\n');
    const len = Number(stdin.shift());
    const arr = stdin.shift().split(' ').filter(e => e.length).map(Number);

    let count = 0;

    for (let maxSortedIndex = 0, l = arr.length; maxSortedIndex < l; maxSortedIndex++) {
        let minNumIndex = maxSortedIndex;
        for (let j = maxSortedIndex, l = arr.length; j < l; j++) {
            if (arr[j] < arr[minNumIndex]) {
                minNumIndex = j;
            }
        }
        if (maxSortedIndex !== minNumIndex) {
            let temp = arr[maxSortedIndex];
            arr[maxSortedIndex] = arr[minNumIndex];
            arr[minNumIndex] = temp;
            count++;
        }
    }

    console.log(arr.join(' '));
    console.log(count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));




