#include <bits/stdc++.h>
using namespace std;
bool compare_by_b(pair<string, int64_t> a, pair<string, int64_t> b) {
  if (a.second != b.second)
    return a.second < b.second;
  else
    return a.first < b.first;
}
bool my_compare(pair<string, int64_t> a, pair<string, int64_t> b) {
  if (a.first != b.first) return a.first < b.first;
  if (a.second != b.second)
    return a.second > b.second;
  else
    return true;
}
int64_t factorial(int64_t n) {
  int64_t x = 1;
  for (int64_t i = 1; i <= n; i++) (x *= i) %= 1000000007;
  return x;
}
int64_t gcd(int64_t a, int64_t b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int64_t modpow(int64_t a, int64_t n, int64_t mod1) {
  int64_t res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod1;
    a = a * a % mod1;
    n >>= 1;
  }
  return res;
}
int64_t combination(int64_t n, int64_t r) {
  int64_t sum = 1;
  for (int64_t i = 1; i <= min(r, n - r); i++)
    (sum *= (n - i + 1)) %= 1000000007;
  return sum;
}
int64_t modinv(int64_t a, int64_t mod1) { return modpow(a, mod1 - 2, mod1); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t n, sum = 0;
  cin >> n;
  vector<int64_t> a(n);
  for (int64_t i = 0; i < n; i++) cin >> a[i];
  for (int64_t i = 0; i < n; i++)
    if (a[i] == (i + 1) && i < (n - 1)) {
      swap(a[i], a[i + 1]);
      sum++;
    }
  cout << sum << endl;
  return 0;
}
