#include <stdio.h>

int main(){
 int n,temp;
 int x[n];
 int i,j,minj;
 int c = 0;

 scanf("%d\n",&n);
 for(i = 0;i < n;i++){
  scanf("%d ",&x[i]);
 }

 for(i = 0;i <= n-1;i++){
  minj = i;
  for(j = 0;j <= n-1;j++){
   if(x[j] < x[minj]){
    minj = j;
    temp = x[minj];
    x[minj] = x[i];
    x[i] = temp;
    c = c + 1;
   }
  }
 }

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

 return 0;
}

 
  
 