#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e+14;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
void Yes() {
  cout << "Yes" << endl;
  exit(0);
}
void No() {
  cout << "No" << endl;
  exit(0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, p[100100];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> p[i];
  int cnt = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    if (p[i] == i + 1) {
      cnt++;
    } else {
      ans += (cnt >= 2 ? cnt - 1 : cnt);
      cnt = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
