#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
const long long int INF = 1e15;
const long long int MOD = 1e9 + 7;
const double PI = 3.14159265358979323846;
signed main() {
  long long int N;
  cin >> N;
  vector<bool> v(N, false);
  for (long long int i = 0; i < (long long int)(N); i++) {
    long long int num;
    cin >> num;
    if (num == i + 1) v[i] = true;
  }
  long long int cnt = 0;
  for (long long int i = 0; i < (long long int)(N - 1); i++) {
    if (v[i] || v[i + 1]) {
      cnt++;
      v[i] = false;
      v[i + 1] = false;
    }
  }
  cout << cnt;
}
