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