#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, a[maxn], ans;
int main() {
  cin >> n;
  for (register int i = 1; i <= n; i++) scanf("%d", a + i);
  for (register int i = 1; i <= n - 1; i++)
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  cout << ans;
  return 0;
}
