#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, times = 0;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    int min = A[i];
    for (int j = 0; j < n; j++) {
      if (A[j] < A[min]) {
        min = j;
      }
      int buf = A[j];
      A[j] = A[min];
      A[min] = buf;
      times++;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    cout << A[i] << " ";
  }
  cout << A[n - 1] << endl;
  cout << times << endl;
}
