#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, t = 0;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) cin >> v[i];
  for (int i = 0; i < N; i++) {
    int min = 1000000007;
    int num = -1;
    for (int j = N - 1; j > i; j--) {
      if (min > v[j]) {
        min = v[j];
        num = j;
      }
    }
    if (v[i] > min) {
      swap(v[i], v[num]);
      t++;
    }
  }
  for (int i = 0; i < N; i++) {
    cout << v[i];
    if (i != N - 1)
      cout << " ";
    else
      cout << endl;
  }
  cout << t << endl;
  return 0;
}
