#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
int a[maxn];
int ans = 0;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    int minn = 99999999, k;
    for (int j = n; j >= i; j--) {
      if (minn > a[j]) minn = a[j], k = j;
    }
    if (a[i] > a[k]) swap(a[i], a[k]), ans++;
  }
  for (int i = 1; i <= n; i++) {
    printf("%d", a[i]);
    if (i != n) printf(" ");
  }
  printf("\n%d\n", ans);
}
