#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
constexpr int MOD = 1000000007;
const int INF = 1 << 30;
int main() {
  int n;
  cin >> n;
  vec p(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> p[i];
    p[i]--;
  }
  int res = 0;
  for (int i = 0; i < (int)(n - 1); i++) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      res++;
    }
  }
  cout << res << "\n";
  return 0;
}
