#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> a;
long long ans;
void output() {
  cout << a[0];
  for (long long i = 1; i < n; i++) {
    cout << " " << a[i];
  }
  cout << endl;
}
int main() {
  cin >> n;
  a = vector<long long>(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (auto itr = a.begin(); itr < a.end(); itr++) {
    auto jtr = min_element(itr, a.end());
    if (itr == jtr) continue;
    swap(*itr, *jtr);
    ans++;
  }
  output();
  cout << ans << endl;
}
