#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
using V = vector<long long>;
void solve_abc_d() {
  long long n;
  long long ans = 0;
  cin >> n;
  V p(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> p[i];
    p[i] -= i + 1;
  }
  for (long long i = 0; i < (long long)(n); i++) {
    if (p[i] == 0) {
      if (i > 0) {
        if (p[i - 1] != -1) {
          p[i]--;
          p[i - 1]++;
          swap(p[i], p[i - 1]);
          ans++;
        }
      } else {
        if (i < n - 1) {
          if (p[i + 1] != -1) {
            p[i + 1]--;
            p[i]++;
            swap(p[i], p[i + 1]);
            ans++;
          }
        }
      }
    }
  }
  cout << ans << "\n";
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve_abc_d();
  return 0;
}
