#include <bits/stdc++.h>
using namespace std;
int A[10];
int cnt = 0;
int trace(int num[], int n) {
  for (int i = 0; i < n; i++) {
    cout << num[i] << " ";
  }
  cout << endl << cnt << endl;
  return 0;
}
int selectionSort(int num[], int n) {
  for (int i = 0; i < n - 1; i++) {
    int flag = 0;
    int v = num[i];
    int kk = i;
    for (int j = i + 1; j < n; j++) {
      if (num[j] < v) {
        flag = 1;
        v = num[j];
        kk = j;
      }
    }
    if (flag == 1) {
      int tt = num[kk];
      num[kk] = num[i];
      num[i] = tt;
      cnt++;
    }
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  selectionSort(A, n);
  trace(A, n);
  return 0;
}
