#include <bits/stdc++.h>
void swap(int *A1, int *A2) {
  int tmp;
  tmp = *A1;
  *A1 = *A2;
  *A2 = tmp;
}
int selectionSort(int A[], int N) {
  int i, j, minj, count = 0;
  for (i = 0; i < N; i++) {
    minj = i;
    for (j = i; j < N; j++) {
      if (A[minj] > A[j]) {
        swap(&A[minj], &A[j]);
        count++;
      }
    }
  }
  return count;
}
int main(void) {
  int N;
  int A[100];
  int i;
  int kai;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  kai = selectionSort(A, N);
  for (i = 0; i < N; i++) {
    if (i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", kai);
  return 0;
}
