#include <bits/stdc++.h>
using namespace std;
int n, p[100005];
int ans;
signed main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i < n; i++) {
    if (p[i] == i || p[i + 1] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans;
  return 0;
}
