#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  int cnt = 0;
  for (int i = 0; i < v.size() - 1; i++) {
    if (v[i] == i + 1) {
      swap(v[i], v[i + 1]);
      cnt++;
    }
  }
  cout << cnt;
}
