#include <bits/stdc++.h>
int main(void) {
  int i, j, k = 0;
  int N, A[100], minj;
  scanf("%d", &N);
  for (i = 0; i < N; i++) scanf("%d ", &A[i]);
  for (i = 0; i < N; i++) {
    minj = i;
    for (j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
        k++;
      }
    }
    A[j] = A[i];
    A[i] = A[minj];
  }
  for (i = 0; i < N; i++) printf("%d ", A[i]);
  printf("%d\n", k);
  return 0;
}
