#include<stdio.h>

int main () {

   int n, i, j, minj, swap;
   int a[100] = {0};
   int count = 0;

   scanf("%d",&n);

   for (i = 0; i < n; i++) {
      minj = i;
   
      for (j = i; j < n; j++) {
         if(a[j] < a[minj])
            minj = j;
      }
      if(i != minj){
         swap = a[i];
         a[i] = a[minj];
         a[minj] = swap;
         count++;
   }

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

   printf("\n");

   printf("%d", count);


   return 0
}