#include <bits/stdc++.h>
int main() {
  int n;
  int A[100];
  int tmp;
  int minj;
  int swap_num = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
    if (n < 1 && n > 100) {
      printf("Error: out of range.");
      return -1;
    }
  }
  if (n > 1) {
    for (int i = 0; i < n; i++) {
      minj = i;
      for (int j = i; j < n; j++) {
        if (A[j] < A[minj]) {
          swap_num += 1;
          minj = j;
        }
      }
      tmp = A[i];
      A[i] = A[minj];
      A[minj] = tmp;
    }
  }
  printf("%d", A[0]);
  for (int i = 1; i < n; i++) {
    printf(" %d", A[i]);
  }
  printf("\n%d\n", swap_num);
}
