#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < (n); ++i) cin >> p[i];
  int ans = 0;
  while (1) {
    bool flg = false;
    for (int i = 0; i < (n - 1); ++i) {
      if (p[i] == i + 1) {
        swap(p[i], p[i + 1]);
        ++ans;
        flg = true;
      }
    }
    if (!flg) break;
  }
  cout << ans << endl;
  return 0;
}
