#include <bits/stdc++.h>
int selectionSort(int array[], int n);
int main(void) {
  int n;
  scanf("%d", &n);
  int *array;
  array = (int *)malloc(n * sizeof(int));
  if (array == NULL) {
    printf("error: failed to allocate memory space\n");
    return 1;
  }
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &array[i]);
  }
  int swap_cnt;
  swap_cnt = selectionSort(array, n);
  for (i = 0; i < n; i++) {
    printf("%d ", array[i]);
  }
  putchar('\n');
  printf("%d\n", swap_cnt);
  free(array);
  return 0;
}
int selectionSort(int array[], int n) {
  int i, j, min_num, min_idx, swap_cnt = 0, temp;
  for (i = 0; i < n - 1; i++) {
    min_num = array[i];
    min_idx = i;
    for (j = i; j < n; j++) {
      if (array[j] < min_num) {
        min_num = array[j];
        min_idx = j;
      }
    }
    if (min_idx != i) {
      swap_cnt++;
      temp = array[i];
      array[i] = min_num;
      array[min_idx] = temp;
    }
  }
  return swap_cnt;
}
