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