var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
var n = +input.shift();
var nums = input.shift().split(' ').map(Number);
var swapTimes = 0;

function selectionSort(numbers) {
  for (var i = 0; i < numbers.length; i++) {
    var minIndex = i;
    for (var j = i; j < numbers.length; j++) {
      if (numbers[j] < numbers[minIndex]) minIndex = j;
    }

    if (minIndex !== i) {
      var tmp = numbers[i];
      numbers[i] = numbers[minIndex];
      numbers[minIndex] = tmp;
      swapTimes++;
    }
  }

  console.log(numbers.join(' '));
  console.log(swapTimes);
}

selectionSort(nums);