#include <bits/stdc++.h>
using namespace std;
const int MAXN = 0x3f3f3f3f;
const int MAXL = 0x7ffff;
inline void read(int &x) {
  x = 0;
  char c = getchar();
  while (c > '9' || c < '0') c = getchar();
  while (c <= '9' && c >= '0') {
    x = x * 10 + c - '0';
    c = getchar();
  }
}
inline void write(int re) {
  if (re > 9) write(re / 10);
  putchar(re % 10 + '0');
}
int a[100000];
int n, ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i < n; i++) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans;
}
