#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
void swap(int &a, int &b) {
  int tmp = a;
  a = b;
  b = tmp;
  return;
}
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (long long(i) = 0; (i) < (n); (i)++) {
    int t;
    cin >> t;
    t--;
    p[i] = t;
  }
  int ans = 0;
  for (long long(i) = 0; (i) < (n - 1); (i)++) {
    if (p[i] == i && p[i + 1] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  for (long long(i) = 0; (i) < (n); (i)++) cout << p[i] << ' ';
  cout << endl;
  for (int i = 0; i < n; ++i) {
    if (p[i] == i) ans++;
  }
  cout << ans << endl;
}
