#include <bits/stdc++.h>
using namespace std;
int cnt[100000];
int main() {
  int n, m, mx = 0;
  cin >> n;
  long long cnt = 0, a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  if (a[0] == 0) {
    cnt++;
  } else if (a[n] == n) {
    cnt++;
  }
  for (int i = 2; i <= n - 1; ++i) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
