#include <bits/stdc++.h>
using namespace std;
long long b[100];
signed main() {
  long long a;
  cin >> a;
  for (long long c = 0; c < a; c++) {
    cin >> b[c];
  }
  long long ans = 0;
  for (long long i = 0; i < a; i++) {
    long long minj = i;
    for (long long j = i; j < a; j++) {
      if (b[j] < b[minj]) {
        minj = j;
      }
      swap(b[i], b[minj]);
      if (i != minj) ans++;
    }
  }
  for (long long i = 0; i < a; i++) {
    if (i) cout << " ";
    cout << b[i];
  }
  cout << endl;
  cout << ans << endl;
}
