process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let n = lines[0] - 0;
  let ns = lines[1].split(" ").map(Number);
  let count = 0;
  let minj;
  for (let i = 0; i < n; i++) {
    minj = i;
    for (j = i; j < n; j++) {
      if (ns[j] < ns[minj]) {
        minj = j;
      }
    }
    if (minj !== i) {
      const t = ns[i];
      ns[i] = ns[minj];
      ns[minj] = t;
      count++;
    }
  }
  console.log(ns.join(" "));
  console.log(count);
});

