#include <stdio.h>

int selectionSort(int array[], int N){
  int c; //入れ替え回数
  int i, j, min_j, tmp;

  c = 0;
  for(i = 0; i < N; i++){
    min_j = i;
    for(j = i; j < N; j++){
      if(array[j] < array[min_j]){
	min_j = j;
      }
    }
    if(i != min_j){
      tmp = array[i];
      array[i] = array[min_j];
      array[min_j] = tmp;
      c++;
    }
  }

  return c;
}


int main(void)
{
  int a[100];
  int num;
  int i, j, min_j;
  int tmp, cnt;

  scanf("%d", &num);
  for(i = 0; i < num; i++){
    scanf("%d", &a[i]);
  }

  cnt = selectionSort(a, num);

  for(i = 0; i < num; i++){
    printf("%d ", a[i]);
  }
  printf("\n");
  printf("%d\n", cnt);

  return 0;
}