#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], ans;
int main() {
  while (~scanf("%d", &n)) {
    ans = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", a + i);
      if (i > 1 && a[i - 1] == i - 1) {
        swap(a[i - 1], a[i]);
        ans++;
      }
    }
    printf("%d\n", ans);
  }
}
