let lines = [];
let reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  const N = parseInt(lines[0]);
  
  var array = [];
  for (var i = 0; i < N; i++) {
    array.push(parseInt(lines[1].split(' ')[i]));
  }
  
  selectionSort(array, N);
});

function selectionSort(array, N) {
  var cnt = 0;
  for (var i = 0; i < N - 1; i++) {
    var min_i = i;
    for (var j = i + 1; j < N; j++) {
      if (array[min_i] > array[j]) min_i = j;
    }
    if (array[i] > array[min_i]) cnt++;
    var tmp = array[i];
    array[i] = array[min_i];
    array[min_i] = tmp;
  }
  console.log(array.join(' '));
  console.log(cnt);
}
