#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const long long MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int i = 0;
  while (i < n) {
    if (a[i - 1] == i) {
      ans += 1;
      i++;
    }
    i++;
  }
  cout << ans << endl;
}
