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