#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
const int MAX = 1000000010;
const long long MOD = 1000000007;
const double PI = acos(-1);
int main() {
  int N;
  cin >> N;
  vector<int> P(N + 1);
  for (int i = 1; i <= N; i++) scanf("%d", &P[i]);
  int cnt = 0;
  for (int i = 1; i <= N; i++) {
    if (P[i] == i) {
      cnt++;
      if (P[i + 1] == i + 1) cnt--;
    }
  }
  cout << cnt << endl;
  return 0;
}
