#include <bits/stdc++.h>
using namespace std;
int arr[100 + 5];
int main() {
  int N;
  int count = 0;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> arr[i];
  for (int i = 0; i < N; i++) {
    int mini = i;
    for (int j = i; j < N; j++) {
      if (arr[j] < arr[mini]) {
        mini = j;
      }
    }
    if (mini != i) {
      count++;
      swap(arr[i], arr[mini]);
    }
  }
  for (int i = 0; i < N; i++) cout << arr[i] << " ";
  cout << endl;
  cout << count << endl;
  return 0;
}
