#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
using Graph = vector<vector<long long>>;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = (long long)0; i < (long long)N; i++) {
    cin >> A[i];
    A[i]--;
  }
  long long ans = 0;
  for (long long i = (long long)0; i < (long long)N - 1; i++) {
    if (A[i] == i) {
      swap(A[i], A[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
