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