var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input = input.split("\n");
var N = parseInt(input[0]);
var A = input[1].split(" ").map(function(e){ return parseInt(e,10)});

var count = 0;
for(var i = 0; i < N; i++){
  var range = A.slice(i);
  var min = Math.min.apply(null,range);
  var rangeIndexMin = range.indexOf(min);
  var AIndexMin = rangeIndexMin + i;
  if(i < AIndexMin){
    A[AIndexMin] = A[i];
    A[i] = min;
    count++;    
  };
}
console.log(A.join(" "));
console.log(count);
