#include <bits/stdc++.h>
void swap(int *x, int *y);
int main() {
  int n, i, j, count = 0, a[100], min;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n - 1; i++) {
    min = i;
    for (j = i; j < n; j++) {
      if (a[j] < a[min]) {
        min = j;
        count++;
      }
    }
    swap(a + i, a + min);
  }
  for (i = 0; i < n - 1; i++) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[n - 1]);
  printf("%d\n", count);
  return 0;
}
void swap(int *x, int *y) {
  int z;
  z = *x;
  *x = *y;
  *y = z;
}
