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