#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<long long, long long>;
using psi = pair<string, long long>;
const long long dx[4] = {1, 0, -1, 0};
const long long dy[4] = {0, 1, 0, -1};
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long N, M, K, H, W, L, R, X;
signed main() {
  cin >> N;
  vi a(N);
  for (long long i = 0; i < (long long)N; i++) {
    cin >> a[i];
    a[i]--;
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)N - 1; i++) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
