#include <bits/stdc++.h>
using namespace std;
int main() {
  int count, A[1000];
  cin >> count;
  for (int i = 0; i < count; i++) {
    cin >> A[i];
  }
  int tradeCount = 0;
  for (int i = 0; i < count; i++) {
    int minJ = count - 1;
    for (int j = i; j < count; j++) {
      if (A[minJ] > A[j]) {
        minJ = j;
      }
    }
    if (minJ != i) {
      swap(A[minJ], A[i]);
      tradeCount++;
    }
  }
  for (int j = 0; j < count; j++) {
    if (j > 0) cout << " ";
    cout << A[j];
  }
  cout << endl;
  cout << tradeCount << endl;
}
