#include <bits/stdc++.h>
using namespace std;
static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const long long L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;
static const int SIZE = 100005;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int p[n];
  int cnt = 0;
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n - 1; ++i) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      ++cnt;
    }
  }
  cout << cnt << '\n';
  return 0;
}
