#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T1, class T2>
ostream& operator<<(ostream& s, pair<T1, T2> P) {
  return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream& operator<<(ostream& s, vector<T> P) {
  for (int i = 0; i < P.size(); ++i) {
    if (i > 0) {
      s << " ";
    }
    s << P[i];
  }
  return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<vector<T> > P) {
  for (int i = 0; i < P.size(); ++i) {
    s << endl << P[i];
  }
  return s << endl;
}
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main() {
  cin.tie(0);
  cout.sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (long long(i) = 0, i_bound = (long long)(N); (i) < i_bound; ++i)
    cin >> A[i];
  int cnt = 0;
  for (long long(i) = 0, i_bound = (long long)(N); (i) < i_bound; ++i) {
    if (i + 1 == A[i]) {
      if (i == 0) {
        swap(A[i], A[i + 1]);
        cnt++;
      } else {
        swap(A[i], A[i - 1]);
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
