#include <bits/stdc++.h>
using namespace std;
int N, a[100005], sol, fcv[100005];
vector<int> pos;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
    if (a[i] == i) {
      pos.push_back(i);
    }
  }
  for (int i = 1; i <= N; ++i) {
    if (a[i] == i) {
      if (i == 1) {
        swap(a[i], a[i + 1]);
        ++sol;
        continue;
      }
      if (i == N) {
        swap(a[i], a[i - 1]);
        ++sol;
        continue;
      }
      if (a[i - 1] != i - 1) {
        swap(a[i], a[i - 1]);
        ++sol;
      } else {
        swap(a[i], a[i + 1]);
        ++sol;
      }
    }
  }
  cout << sol << '\n';
  return 0;
}
