#include <bits/stdc++.h>
int main(void) {
  int data_num;
  int dn;
  int *pSortBuff;
  int sn = 0;
  int minj;
  int i, j;
  int swap;
  scanf("%d", &dn);
  pSortBuff = (int *)malloc(sizeof(int) * dn);
  while ((scanf("%d", &(pSortBuff[data_num])) != EOF) && data_num < dn) {
    data_num++;
  }
  if (data_num == dn) {
    for (i = 0; i < dn; i++) {
      minj = i;
      for (j = i; j < dn; j++) {
        if (pSortBuff[minj] > pSortBuff[j]) {
          minj = j;
        }
      }
      if (minj != i) {
        swap = pSortBuff[minj];
        pSortBuff[minj] = pSortBuff[i];
        pSortBuff[i] = swap;
        sn++;
      }
    }
  } else {
  }
  for (i = 0; i < dn; i++) {
    printf("%d ", pSortBuff[i]);
  }
  printf("\n%d\n", sn);
  free(pSortBuff);
  return 0;
}
