#include <stdio.h>
int main(void){
  int i, j, cnt = 0, minj, k,temp;
  int numbers[100];
 
  scanf("%d", &k);
   
  for(i = 0;i < k;i++){
    scanf("%d", &numbers[i]);
  }
 
  for(i = 0; i < k; i++ ) {
    minj = i;
    for(j= i; j < k; j++) {
      if(numbers[j] < numbers[minj]) {
         minj = j;
         temp = numbers[i];
         numbers[i] = numbers[minj];
         numbers[minj] = minj;
         cnt++;
      }

    }
  }
  for(i = 0;i < k-1;i++){
    printf("%d ", numbers[i]);
  }
  printf("%d\n", numbers[i]);
  printf("%d\n", cnt);
  return 0;
}
