#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int m = i;
    for (int j = i + 1; j < n; j++) {
      if (a[j] < a[m]) m = j;
    }
    if (m != i) ans++;
    swap(a[m], a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl << ans << endl;
  return 0;
}
