#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> p(N);
  for (auto& ele : (p)) cin >> ele;
  int ans = 0;
  if (p[0] == 1) {
    swap(p[0], p[1]);
    ans += 1;
  }
  for (int i = 1; i < N - 1; i++) {
    if (p[i] == i + 1) {
      if (p[i + 1] != i + 2) {
        swap(p[i], p[i + 1]);
        ans += 1;
      } else if (p[i - 1] != i) {
        swap(p[i], p[i - 1]);
        ans += 1;
      } else {
        swap(p[i], p[i + 1]);
        ans += 1;
      }
    }
  }
  if (p[N - 1] == N) {
    swap(p[N - 1], p[N - 2]);
    ans += 1;
  }
  cout << (ans) << " " << endl;
  return 0;
}
