#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
int p[M];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; ++i) cin >> p[i];
    int ans = 0;
    for (int i = 1; i < n; ++i) {
      if (p[i] == i) {
        ++ans;
        swap(p[i], p[i + 1]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
