#include <bits/stdc++.h>
int main(void) {
  int A[100] = {0}, N, S = 0;
  int a, b, c, min, tmp;
  scanf("%d", &N);
  for (a = 0; a < N; a++) {
    scanf("%d", &A[a]);
  }
  for (b = 0; b < N; b++) {
    min = b;
    for (c = b; c < N; c++) {
      if (A[c] < A[min]) {
        min = c;
        S++;
      }
      tmp = A[b];
      A[b] = A[min];
      A[min] = tmp;
    }
  }
  for (a = 0; a < N; a++) {
    printf("%d", A[a]);
    if (a != N) {
      printf(" ");
    }
  }
  printf("\n%d\n", S);
  return 0;
}
