#include<stdio.h>

int main()
{
  int n, int data[99], i, j,  minj, A, count;
  ocunt = 0;
   
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &data[i]);
  }
  
  for(i = 0; i < n; i++){
    minj = i;
    for(j = i; j < n; j++){
      if (data[j] < data[minj]{
        minj = j;
        A = data[j];
        data[j] = data[minj];
        data[minj] = A;
        count++;
      }
    }
  }
  
  printf("%d", data[0]);
  for(i = 1; i < n; i++){
    printf(" %d", data[i]);
  }
  printf("\n%d\n", count);
 }