#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;
signed main() {
  int n;
  cin >> n;
  int p[n];
  for (int i = 0; i < (n); i++) {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < (n - 1); i++) {
    if (p[i] == i + 1) {
      int t = p[i];
      p[i] = p[i + 1];
      p[i + 1] = t;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
