#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int* num = new int[n];
    for (int i = 0; i < n; i++) {
      cin >> num[i];
    }
    int cnt = 0, m;
    for (int i = 0; i < n - 1; i++) {
      m = i;
      for (int j = i; j < n; j++) {
        if (num[j] < num[m]) {
          m = j;
        }
      }
      if (i < m) {
        int tmp = num[i];
        num[i] = num[m];
        num[m] = tmp;
        cnt++;
      }
    }
    for (int i = 0; i < n; i++) {
      printf("%d ", num[i]);
    }
    printf("\n");
    cout << cnt << endl;
  }
}
