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