#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-9;
struct edge {
  int from, to;
  edge(int from, int to) {
    this->from = from;
    this->to = to;
  }
};
int V, E;
vector<vector<edge> > G;
int p[100005];
int n;
int main() {
  scanf("%d ", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d ", &p[i]);
  }
  int ans = 0;
  for (int i = 1; i <= n - 1; ++i) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
