#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; ++i) res = res * i;
  return res;
}
long long nCr(long long n, long long r) {
  return (fact(n) / fact(n - r) * fact(r));
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
const int inf = 1 << 30;
int N;
int p[100000];
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < (int)(N); ++i) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int cur = i + 1;
    if (p[i] == cur) {
      if (i - 1 < 0) {
        swap(p[i], p[i + 1]);
      } else {
        swap(p[i], p[i - 1]);
      }
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
