#include <bits/stdc++.h>
using namespace std;
vector<int> p;
vector<int> look;
int func(int i) {
  if (i == 0) {
    swap(p[0], p[1]);
    if (look[1] == 1) look[1] = 0;
    return 1;
  } else {
    swap(p[i], p[i + 1]);
    if (look[i + 1] == 1) look[i + 1] = 0;
    return 1;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  p.resize(n);
  look.resize(n);
  for (int i = 0; i < (n); ++i) {
    cin >> p[i];
    if (p[i] == i + 1) look[i]++;
  }
  int h = 0;
  for (int i = 0; i < n - 1; i++) {
    if (look[i]) {
      h += func(i);
    }
  }
  cout << h << endl;
}
