#include <bits/stdc++.h>
int n, i, f = 1, ans;
int main() {
  std::cin >> n;
  int p[n];
  for (; i < n;) std::cin >> p[i], (p[i] == ++i && f) ? ans++, f = 0 : f = 1;
  std::cout << ans;
  return 0;
}
