#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> p(N + 1);
  p[0] = 1;
  for (int i = 1; i <= N; i++) {
    cin >> p[i];
  }
  bool check = true;
  while (check) {
    check = false;
    for (int i = 1; i <= N; i++) {
      if (p[i] == i) {
        check = true;
        if (p[i - 1] != i) {
          swap(p[i - 1], p[i]);
          ans++;
        } else if (p[i + 1] != i) {
          swap(p[i], p[i + 1]);
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
