#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned int s[100000] = {}, n;
  int p = 0;
  cin >> n;
  if (n >= 2) {
    for (int i = 0; i <= n - 1; i++) {
      cin >> s[i];
    }
    for (int l = 0; l < n - 1; l++) {
      if (s[l] == l + 1) {
        int m = s[l + 1];
        s[l + 1] = s[l];
        s[l] = m;
        p++;
      }
    }
    for (int i = 0; i <= n - 1; i++) {
      cout << s[i] << endl;
    }
    cout << p;
  }
}
