#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
const long long INF = 1e17 + 7;
const long long MOD = 1e9 + 7;
const double PI = acos(-1);
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == i) {
      cnt++;
      if (a[i + 1] == i + 1) cnt--;
    }
  }
  cout << cnt << endl;
  return 0;
}
