#include <bits/stdc++.h>
using namespace std;
void printArray(int *x, int n) {
  for (int i = 0; i < n; i++) {
    cout << x[i];
    if (i < n - 1) {
      cout << " ";
    }
  }
  cout << endl;
}
int selectionSort(int *a, int n) {
  int count = 0;
  for (int i = 0; i < n; i++) {
    int minj = i;
    for (int j = i; j < n; j++) {
      if (a[j] < a[minj]) {
        minj = j;
        count++;
      }
    }
    if (a[i] != a[minj]) {
      int temp = a[i];
      a[i] = a[minj];
      a[minj] = temp;
      count++;
    }
  }
  printArray(a, n);
  return count;
}
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << selectionSort(a, n) << endl;
}
int main() {
  solve();
  return 0;
}
