#include <bits/stdc++.h>
using namespace std;
void Main() {
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> check(n, 0);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> p[i];
    if (p[i] == i + 1) check[i] = 1;
  }
  int ans = 0;
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    if (check[i] == 1) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
  return;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
