#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long p[100001];
  for (long long k = 0; k <= 100000; k++) {
    p[k] = 0;
  };
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> p[i];
  }
  long long res = 0;
  for (long long i = 0; i <= (long long)(n - 1); i++) {
    if ((i != n - 1) && (p[i] == i + 1)) {
      swap(p[i], p[i + 1]);
      res++;
    } else if ((i != n - 1) && (p[i] == i + 1)) {
      swap(p[i], p[i - 1]);
      res++;
    }
  }
  cout << res << endl;
  return 0;
}
