#include <bits/stdc++.h>
using namespace std;
int main() {
  int b = 0, n, i, minj, j, minv, swap;
  int a[100];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    minv = a[i + 1];
    for (j = i + 1; j < n; j++) {
      if (minv > a[j]) {
        minv = a[j];
        minj = j;
      }
    }
    if (minv < a[i]) {
      swap = a[i];
      a[i] = a[minj];
      a[minj] = swap;
      b++;
    }
  }
  for (i = 0; i < n - 1; i++) {
    cout << a[i] << " " << flush;
  }
  cout << a[n - 1] << endl;
  cout << b << endl;
  return 0;
}
