#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long lg(long long a) {
  long long b = a;
  long long cnt = 0;
  while (b % 2 == 0) {
    b /= 2;
    cnt++;
  }
  return cnt;
}
long long n;
long long p[200000];
long long ans = 0;
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> p[i];
  for (long long i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
