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