#include <bits/stdc++.h>
using LL = long long;
using namespace std;
const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};
const double EPS = 1e-10;
const double PI = acos(-1.0);
void print(vector<int> v) {
  int n = v.size();
  for (int i = 0; i < n; i++) {
    if (i) cout << ' ';
    cout << v[i] << endl;
  }
}
void selection_Sort(vector<int> v, int n) {
  int cnt = 0;
  for (int i = 0; i <= n - 1; i++) {
    int min_j = i;
    for (int j = i; j <= n - 1; j++) {
      if (v[j] < v[min_j]) {
        min_j = j;
        swap(v[j], v[min_j]);
        cnt++;
      }
    }
  }
  print(v);
  cout << cnt << endl;
}
signed main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int _ = (0); _ < (n); ++_) {
    int num;
    cin >> num;
    v.push_back(num);
  }
  selection_Sort(v, n);
}
