#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  cin >> N;
  vector<long long int> num(N, 0);
  long long int cnt = 0;
  long long int streak = 0;
  for (int i = 1; i <= N; i++) {
    cin >> num[i];
    if (num[i] == i) {
      cnt++;
      streak++;
      if (streak % 2 == 0) {
        cnt--;
      }
    } else {
      streak = 0;
    }
  }
  cout << cnt << endl;
}
