#include <bits/stdc++.h>
using namespace std;
static const double PI = 3.1415926535897932384626433;
static const long long LL_MAX = (long long)1 << 55;
static const long long WF_MAX = 300;
long long wf[WF_MAX][WF_MAX];
long long f[WF_MAX][WF_MAX] = {};
bool WarshalFloyid(int size) {
  for (long long k = 0; k < size; k++)
    for (long long i = 0; i < size; i++)
      for (long long j = 0; j < size; j++) {
        if (wf[i][k] + wf[k][j] < wf[i][j]) {
          cout << -1 << endl;
          return false;
        }
        if (wf[i][k] + wf[k][j] == wf[i][j] && i != k && j != k) {
          f[i][j] = true;
        }
      }
  return true;
}
int main() {
  long long N;
  cin >> N;
  long long p[100001] = {};
  for (long long i = 1; i <= N; i++) {
    long long q;
    cin >> q;
    p[i] = q;
  }
  long long cnt = 0;
  for (long long i = 1; i < N; i++) {
    if (p[i] == i) {
      long long t = p[i + 1];
      p[i + 1] = p[i];
      p[i] = t;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
