#include <bits/stdc++.h>
int main() {
  int N, A[100], i, j;
  int c = 0, minj, x;
  scanf("%d", &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]) {
        minj = j;
        c++;
      }
    }
    x = A[i];
    A[i] = A[minj];
    A[minj] = x;
  }
  i = 0;
  while (1) {
    printf("%d", A[i]);
    if (i == N - 1) break;
    printf(" ");
    i++;
  }
  printf("\n");
  printf("%d\n", c / 2);
  return 0;
}
