#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;

int selectionSort(A[], N){
  int i, j, minj, cnt;

  for(i = 0; i < N; i++){
    minj = i ;
    for(j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
      swap(A[i], minj);
      cnt++; 
      }
    }
  }

  return cnt;
}

int main(){
  int N, A[100], cnt;
  
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];

  cnt = selectionSort(A, N);

  for(i = 0; i < N; i++){
    if(i){
      cout << " ";
    }
    cout << A[i];
  }
  cout << endl;
  cout << cnt << endl; 
}