#include <bits/stdc++.h>
int main() {
  int i, j;
  int minj;
  int N;
  int count = 0;
  int temp;
  int data[110];
  scanf("%d", &N);
  for (i = 0; i < N; ++i) {
    scanf("%d", &data[i]);
  }
  for (i = 0; i < N; ++i) {
    minj = i;
    for (j = i; j < N; ++j) {
      if (data[minj] > data[j]) {
        minj = j;
        count++;
      }
    }
    temp = data[i];
    data[i] = data[minj];
    data[minj] = temp;
  }
  for (i = 0; i < N - 1; ++i) {
    printf("%d ", data[i]);
  }
  printf("%d", data[N - 1]);
  putchar('\n');
  printf("%d\n", count);
  return 0;
}
