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