var selectionSort = function(arr, n) {
  var numSwapped = 0;
  for (var i = 0; i < n; i += 1) {
    var minj = i;
    for (var j = i; j < n; j += 1) {
      if (arr[j] < arr[minj]) {
        minj = j;
      }
    }
    if (minj !== i) {
      var temp = arr[i];
      arr[i] = arr[minj];
      arr[minj] = temp;
      numSwapped += 1;
    }
  }
  return numSwapped;
};

var n = 0;
var arr = [];
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input.split('\n').forEach(function(line, i) {
  if (line !== '') {
    if (i % 2 === 0) {
      n = parseInt(line, 10);
    } else {
      arr = line.trim().split(' ').map(Number);
      var num = selectionSort(arr, n);
      console.log(arr.join(' '));
      console.log(num);
    }
  }
});