#include<stdio.h>
int main (void){
  int A[100];
  int n, a, d, i, j, minj;
  a = 0;
  scanf("%d", &n);
  for (i = 0;i < n;i++)
    scanf ("%d", &A[i]);
  for (i = 0;i < n;i++){
    minj = i;
    for (j = i;j < n;j++){
      if (A[j] < A[minj]){
        minj = j;
        d = A[i];
        A[i] = A[minj];
        A[minj] = d;
        a++;
      }
    }
  }
  for (i = 0;i < n;i++)
    printf ("%d ",A[i]);
  printf ("\n");
  printf ("%d", a);
  return 0;
 }