#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
int n;
int ar[100010];
int ans = 0;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 1; i < n; i++) {
    if (ar[i] == i) {
      ans++;
      swap(ar[i], ar[i + 1]);
    }
  }
  printf("%d", ans);
  return 0;
}
