#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v;
  for (int a, i = 0; i < n; ++i) {
    scanf("%d", &a);
    v.push_back(a);
  }
  int sol = 0;
  for (int i = 0; i < n; ++i) {
    if (i < n - 1 && v[i] == i + 1) {
      swap(v[i], v[i + 1]);
      ++sol;
    }
  }
  printf("%d\n", sol);
  return 0;
}
