'use strict';

const main = input => {
  input = input.split('\n');
  const N = Number(input[0]);
  const A = input[1].split(' ').map(Number);
  selectionSort(A, N);
};

function selectionSort(A, N) {
  let count = 0;
  for (let i = 0; i < N - 1; ++i) {
    let minj = i;
    for (let j = i; j < N; ++j) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }
    if (i !== minj) {
      const tmp = A[i];
      A[i] = A[minj];
      A[minj] = tmp;
      ++count;
    }
  }
  console.log(A.join(' '));
  console.log(count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

