#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[1001];
  int num;
  for (int i = 0; i < 1001; i++) {
    A[i] = 0;
  }
  cin >> num;
  for (int i = 0; i < num; i++) {
    scanf("%d", &A[i]);
  }
  void selectionSort(int A[], int N);
  selectionSort(A, num);
  return 0;
}
void selectionSort(int A[], int N) {
  int minj;
  int tmp;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    minj = i;
    for (int j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
        cnt++;
      }
    }
    tmp = A[i];
    A[i] = A[minj];
    A[minj] = tmp;
  }
  for (int k = 0; k < N - 1; k++) {
    cout << A[k] << " ";
  }
  cout << A[N - 1];
  cout << endl;
  cout << cnt << endl;
}
