#include <stdio.h>

int selectionSort(int A[100], int N) {
     
     int minj, i, j, k;
     int C = 0;
     for (i = 0; i < N; i++){
          minj = i;
          for (j = i; j < N; j++){
                 if(A[j] < A[minj]){
                       minj = j;
                       k = A[i];
                       A[i] = A[minj];
                       A[minj] = k;
                       }                            }
                 }
                 if (i != minj){
                            C++;
                            }
          }

     return C;

}

int main () {

     int A[100], N, i;
     int C = 0;
     scanf("%d", &N);
     for (i = 0; i < N; i++){
          scanf("%d", &A[i]);
     }

   C =  selectionSort(A, N);

          for (i = 0; i < N-1; i++){
           printf("%d ", A[i]);
     }

     printf("%d\n", A[N-1]);
     printf("%d\n", C);

     return 0;

}