#include <bits/stdc++.h>
　#include<vector> template <class T, class S>
void cmin(T &a, const S &b) {
  if (a > b) a = b;
}
template <class T, class S>
void cmax(T &a, const S &b) {
  if (a < b) a = b;
}
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 1; i <= n; i++) {
    int index = i - 1;
    if (v[index] != i) continue;
    ans++;
    if (!index)
      swap(v[0], v[1]);
    else if (index == n)
      swap(v[n - 1], v[n - 2]);
    else {
      if (v[index] < v[index + 1])
        swap(v[i], v[index]);
      else if (v[index] > v[index - 1])
        swap(v[index], v[index - 1]);
    }
  }
  cout << ans << endl;
}
