#include <bits/stdc++.h>
int count = 0;
void selectionSort(int A[], int n) {
  int k, l, tmp, minl;
  for (k = 0; k < n - 1; k++) {
    minl = k;
    for (l = k; l < n - 1; l++) {
      if (A[l] < A[minl]) {
        minl = l;
        count++;
      }
    }
    tmp = A[k];
    A[k] = A[minl];
    A[minl] = tmp;
  }
}
int main() {
  int i, j, n;
  int A[100 + 1];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  selectionSort(A, n);
  for (j = 1; j <= n; j++) {
    if (j > 1) {
      printf(" ");
    }
    printf("%d", A[j - 1]);
  }
  printf("\n");
  printf("%d\n", count);
  return 0;
}
