#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
const int mod = 1000000007;
int main() {
  int n, c = 0, t = 0;
  cin >> n;
  vector<int> a(n);
  for (auto i = 0; i < n; i++) cin >> a[i];
  for (auto i = 0; i < n; i++) {
    if (a[i] == i + 1) {
      c++, t++;
    } else {
      if (t >= 2) c--;
      t = 0;
    }
  }
  printf("%d\n", c);
  return 0;
}
