function main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var values = input[1].split(" ").map(function(v) { return parseInt(v); });
  var count = selectionSort(values, N);
  console.log(values.join(' '));
  console.log(count);
}

function selectionSort(a, N) {
  var count = 0;
  for (var i = 0; i < N; i++) {
    var minj = i;
    for (var j = i; j < N; j++) {
      if (a[j] < a[minj]) {
        minj = j;
      }
    }

    if (minj != i) {
      count++;
      var tmp = a[i];
      a[i] = a[minj];
      a[minj] = tmp;
    }
  }
  return count;
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));