#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  long long N, cnt = 0, ans = 0;
  cin >> N;
  long long X[N];
  for (long long(i) = 0; (i) < (N); (i)++) {
    cin >> X[i];
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    if ((i + 1) == X[i]) {
      cnt++;
      continue;
    }
    ans += (cnt + 1) / 2;
    cnt = 0;
  }
  cout << ans;
}
