#include <bits/stdc++.h>
int main() {
  int N, i, j, m, s, g = 0;
  scanf("%d", &N);
  int A[N], count = 0;
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for (i = 0; i < N; i++) {
    m = A[i + 1];
    for (j = i + 1; j < N; j++) {
      if (A[i] > A[j] && m > A[j]) {
        m = A[j];
        s = j;
        g = 1;
      }
    }
    if (g == 1) {
      A[s] = A[i];
      A[i] = m;
      count++;
      g = 0;
    }
  }
  for (i = 0; i < N; i++) {
    printf("%d ", A[i]);
  }
  printf("\n%d\n", count);
  return 0;
}
