const selectionSort = (n, a) => {
  let counter = 0;
  for (let i = 0; i < n; i++) {
    minIndex = i;
    for (let j = i; j < n; j++) {
      if (a[minIndex] > a[j]) {
        minIndex = j;
      }
    }
    if (minIndex != i) {
      let tmp = a[minIndex];
      a[minIndex] = a[i];
      a[i] = tmp;
      counter += 1;
    }
  }
  console.log(a.join(" "));
  console.log(counter);
};

selectionSort("5", "1 2 3 4 5".split(" "));
selectionSort("1", "100".split(" "));
selectionSort("6", "6 5 4 3 2 1".split(" "));

process.stdin.resume();
process.stdin.setEncoding("utf8");
let input_string = "";

process.stdin.on("data", chunk => {
  input_string += chunk;
});

process.stdin.on("end", () => {
  const lines = input_string.split("\n").filter(v => {
    return v !== "";
  });
  selectionSort(lines[0], lines[1].split(" ").map(i => parseInt(i, 10)));
});

