#include <bits/stdc++.h>
using namespace std;
long long a7 = 1000000007;
long long inf = 1000000000000000;
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
int main() {
  long long n;
  cin >> n;
  long long p[n];
  for (long long i = 0; i <= n - 1; i++) {
    cin >> p[i];
  }
  long long ans = 0;
  long long l;
  for (long long i = 0; i <= n - 2; i++) {
    if (p[i] == i + 1) {
      ans++;
      l = p[i];
      p[i] = p[i + 1];
      p[i + 1] = l;
    }
  }
  cout << ans << endl;
  return 0;
}
