#include <bits/stdc++.h>
int SelectionSort(int a[100], int n);
int main() {
  int a[100], n, i, c;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  c = SelectionSort(a, n);
  for (i = 0; i < n; i++) printf("%d ", a[i]);
  printf("\n%d\n", c);
  return 0;
}
int SelectionSort(int a[100], int n) {
  int i, j, x;
  int c = 0;
  for (i = 0; i < n - 1; i++) {
    if (a[i] != i + 1) {
      for (j = i + 1; j < n; j++) {
        if (a[j] == i + 1) break;
      }
      x = a[j];
      a[j] = a[i];
      a[i] = x;
      c += 1;
    }
  }
  return c;
}
