#include <bits/stdc++.h>
using namespace std;
int n, p[100005], ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n - 1; ++i)
    if (p[i] == i) {
      int t = p[i];
      p[i] = p[i + 1];
      p[i + 1] = t;
      ans++;
    }
  if (p[n - 1] == n - 1) ans++;
  cout << ans;
  system("pause");
  return 0;
}
