#include <bits/stdc++.h>
using namespace std;
long long inf = 1000000007;
long long p[200005];
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  long long count = 0;
  for (int i = 1; i <= n; i++) {
    if (i == p[i - 1]) {
      count++;
      if (p[i - 1] + 1 == p[i] && i != n) {
        count--;
      }
    }
  }
  cout << count << endl;
  return 0;
}
