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