#include <bits/stdc++.h>
int selectionSort(int array[], int arraySize);
int main() {
  int arraySize = 0;
  scanf("%d", &arraySize);
  int* array = (int*)malloc(sizeof(int) * arraySize);
  for (int i = 0; i < arraySize; i++) {
    scanf("%d", &array[i]);
  }
  int counter = selectionSort(array, arraySize);
  for (int i = 0; i < arraySize; i++) {
    printf("%d ", array[i]);
  }
  printf("\n%d\n", counter);
  return 0;
}
int selectionSort(int array[], int arraySize) {
  int minPlace = 0;
  int flag = 0;
  int counter = 0;
  for (int i = 0; i < arraySize; i++) {
    flag = 0;
    minPlace = i;
    for (int j = i + 1; j < arraySize; j++) {
      if (array[minPlace] > array[j]) {
        flag++;
        minPlace = j;
      }
    }
    if (flag > 0) {
      flag = array[i];
      array[i] = array[minPlace];
      array[minPlace] = flag;
      counter++;
    }
  }
  return counter;
}
