#include <bits/stdc++.h>
using namespace std;
long long n, a[1000005], res = 0;
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n - 1; i++) {
    if (a[i] == i || (a[i] != i && a[i + 1] == i + 1)) {
      res++;
      swap(a[i], a[i + 1]);
    }
  }
  cout << res;
}
