#include <bits/stdc++.h>
int main() {
  int n, minj, j, i, x, count, test = 0;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    minj = i;
    for (j = i; j < n; j++) {
      if (a[j] < a[minj]) {
        x = a[j];
        a[j] = a[minj];
        a[minj] = x;
        if (j == (n - 1)) count++;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (i != (n - 1))
      printf("%d ", a[i]);
    else
      printf("%d\n", a[i]);
  }
  printf("%d\n", count);
  return 0;
}
