#include <bits/stdc++.h>
using namespace std;
int selectionSort(int a[], int N) {
  int sw = 0;
  int m;
  for (int j = 0; j < N - 1; j++) {
    int min = a[j];
    for (int i = j + 1; i < N; i++) {
      if (a[i] < min) {
        min = a[i];
        m = i;
      }
    }
    if (a[m] < a[j]) {
      swap(a[m], a[j]);
      sw++;
    }
  }
  return sw;
}
int main() {
  int N, sw;
  cin >> N;
  int a[100];
  for (int i = 0; i < N; i++) cin >> a[i];
  sw = selectionSort(a, N);
  for (int i = 0; i < N; i++) {
    if (i) cout << " ";
    cout << a[i];
  }
  cout << endl;
  cout << sw << endl;
}
