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