#include <bits/stdc++.h>
using namespace std;
void a() {
  int X, t;
  cin >> X >> t;
  if (X <= t) {
    cout << 0 << endl;
  } else {
    cout << X - t << endl;
  }
}
void b() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if ((i % 2) == 0) {
      cout << s[i];
    }
  }
  cout << endl;
}
void c() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> v(100000, 0);
  for (auto e : a) {
    v[e]++;
  }
  int resut = v[0] + v[1];
  for (int i = 1; i < 100000 - 1; i++) {
    int temp = v[i - 1] + v[i] + v[i + 1];
    if (resut < temp) resut = temp;
  }
  cout << resut << endl;
}
void d() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int count = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      int temp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = temp;
      count++;
    }
  }
  cout << count << endl;
}
int main() {
  d();
  return 0;
}
