#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans = 0, left, right;
  int p[100000] = {0};
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  if (p[0] == 1) {
    ans++;
    left = p[0];
    right = p[1];
    p[0] = right;
    p[1] = left;
  }
  for (int i = 0; i < N; i++) {
    {
      if (p[i] == i + 1) {
        ans++;
        left = p[i - 1];
        right = p[i];
        p[i - 1] = right;
        p[i] = left;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
