#include <stdio.h>

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 = 0;
  for(i = 0; i < num; i++){
    min_j = i;
    for(j = i; j < num; j++){
      if(a[j] < a[min_j]){
	min_j = j;
      }
    }
    if(i != min_j){
      tmp = a[i];
      a[i] = a[min_j];
      a[min_j] = tmp;
      cnt++;
    }
  }

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

  return 0;
}