#include <bits/stdc++.h>
static const int N = 100;
int main() {
  int n, i, j;
  int A[N + 1];
  int minj, swap, sort = 0;
  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;
        swap = A[i];
        A[i] = A[minj];
        A[minj] = swap;
        sort++;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (i < n - 1)
      printf("%d ", A[i]);
    else
      printf("%d\n", A[i]);
  }
  printf("%d\n", sort);
  return 0;
}
