#include <bits/stdc++.h>
using namespace std;
int N, swaps = 0;
int arr[100];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < N; i++) {
    int minIdx = i;
    int minVal = arr[i];
    for (int j = i + 1; j < N; j++) {
      if (arr[j] < minVal) {
        minVal = arr[j];
        minIdx = j;
        swaps++;
      }
    }
    swap(arr[i], arr[minIdx]);
  }
  for (int k = 0; k < N; k++) {
    cout << arr[k] << " ";
  }
  cout << endl;
  cout << swaps;
  cin.get();
  return 0;
}
