#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  cin >> P;
  for (int i = 0; i < (int)(N); i++) P[i]--;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (i == P[i]) {
      if (i == 0) {
        swap(P[i], P[i + 1]);
        cnt++;
      } else if (P[i - 1] < P[i]) {
        swap(P[i - 1], P[i]);
        cnt++;
      } else if (i + 1 < N && P[i] < P[i + 1]) {
        swap(P[i], P[i + 1]);
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
