#include <bits/stdc++.h>
using namespace std;
using ll = long long;
string char_to_string(char val) { return string(1, val); }
int main() {
  int N;
  cin >> N;
  vector<ll> p(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) cin >> p[i];
  int cnt = 0;
  for (int i = 0, i_len = (N - 1); i < i_len; ++i) {
    if (i + 1 == p[i]) {
      swap(p[i], p[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
}
