#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1000003;
int main() {
  int n;
  cin >> n;
  int p[n];
  for (int i = (int)0; i < (int)n; ++i) {
    cin >> p[i];
    p[i]--;
  }
  int ans = 0;
  for (int i = (int)0; i < (int)n; ++i) {
    if (p[i] == i) {
      if (i + i < n && p[i + 1] == i + 1) i++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
