#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<long long, long long>;
const long long IINF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long INF = sizeof(long long) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9 + 7;
const long long limit = 100007;
long long n;
long long p[limit];
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (long long i = (0); i < (n); i++) cin >> p[i];
  long long c = 0;
  for (long long i = (0); i < (n - 1); i++) {
    if (p[i] == i + 1) {
      p[i + 1] = p[i];
      c++;
    }
  }
  cout << c << '\n';
  return 0;
}
