#include <bits/stdc++.h>
using namespace std;
int64_t gcd(int64_t a, int64_t b) { return (a % b == 0 ? b : gcd(b, a % b)); }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int factorial(int a) {
  int b = 1;
  while (a) {
    b *= a--;
  }
  return b;
}
bool is_prime(int64_t a) {
  if (a <= 1) return false;
  for (int64_t i = 2; (int64_t)i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
int get_adp(double x, int n) {
  return (int)round((x - (int)x) * pow(10, n)) % 10;
}
int64_t sigma(int64_t s, int64_t n) { return n * (2 * s + n - 1) / 2; }
int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) {
    if (i == n - 1 && p[n - 1] == n) ans++;
    if (p[i] == i + 1) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}
