function selectionSort(lgh, arr) {
  var count = 0;
  for(let i = 0; i < lgh-1; i++) {
    var tmp = i;
    for(let j = i; j < lgh; j++) {
      if(Number(arr[j]) < Number(arr[tmp])) {
        tmp = j;
      }
    }
    if(i != tmp) {
      [arr[i], arr[tmp]] = [arr[tmp], arr[i]];
      count++;
    }
  }
  console.log(arr.join(" "));
  return count;
}
function Main(input) {
  var [a, b] = input.split("\n");
  console.log(selectionSort(a, b.split(" ")));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

