#include <bits/stdc++.h>
int main(void) {
  int n, i, j, temp, count = 0, min = 9999999, flag = -1, flag_r = -1;
  scanf("%d", &n);
  int r[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &r[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (r[j] < min) {
        min = r[j];
        flag = j;
        flag_r = 1;
      }
      if (flag_r == 1 && j == n - 2) {
        temp = r[flag];
        r[flag] = r[i];
        r[i] = temp;
        count = count + 1;
        min = 9999999;
        flag = -1;
        flag_r = -1;
      }
    }
  }
  for (i = 0; i < n; i++) {
    printf("%d", r[i]);
    if (i != n - 1) printf(" ");
  }
  puts("");
  printf("%d\n", count);
  return 0;
}
