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