#!/usr/bin/env node
// https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/2/ALDS1_2_B

"use strict";
(function (stdin) {
  const [n, a] = stdin.toString().trim().split("\n");
  const N = Number(n);
  const A = a.split(" ").map(Number);
  let minj;
  let count = 0;
  for (let i = 0; i < N; i++) {
    minj = i;
    for (let j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }
    if (A[minj] !== A[i]) {
      let prev = A[minj];
      A[minj] = A[i];
      A[i] = prev;
      count++;
    }
  }
  console.log(A.join(" "));
  console.log(count);
})(require("fs").readFileSync("/dev/stdin", "UTF-8"));

